[Teton] Add ls and cd commands to rust impl.
This commit is contained in:
parent
c155247f1d
commit
f5a27156d2
4 changed files with 71 additions and 20 deletions
|
|
@ -1,32 +1,14 @@
|
|||
use crate::OpenFileRequest;
|
||||
use crate::VFSClient;
|
||||
use alloc::string::ToString;
|
||||
use mammoth::zion::ZError;
|
||||
|
||||
static mut VFS_CLIENT: Option<VFSClient> = None;
|
||||
|
||||
fn get_client() -> &'static mut VFSClient {
|
||||
unsafe {
|
||||
if let None = VFS_CLIENT {
|
||||
let endpoint_cap = yellowstone::from_init_endpoint()
|
||||
.get_endpoint(&yellowstone::GetEndpointRequest {
|
||||
endpoint_name: "victoriafalls".to_string(),
|
||||
})
|
||||
.expect("Failed to get VFS endpoint");
|
||||
|
||||
VFS_CLIENT = Some(VFSClient::new(endpoint_cap.endpoint));
|
||||
}
|
||||
VFS_CLIENT.as_mut().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct File {
|
||||
memory: mammoth::mem::MemoryRegion,
|
||||
}
|
||||
|
||||
impl File {
|
||||
pub fn open(path: &str) -> Result<Self, ZError> {
|
||||
let vfs = get_client();
|
||||
let vfs = crate::get_client();
|
||||
let resp = vfs.open_file(&OpenFileRequest {
|
||||
path: path.to_string(),
|
||||
})?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue