Skip to content

Commit

Permalink
Handle args
Browse files Browse the repository at this point in the history
  • Loading branch information
diqiu50 committed Jan 3, 2025
1 parent d0bb9d8 commit 50f1931
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions clients/filesystem-fuse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,25 @@ use tokio::signal;
async fn main() -> fuse3::Result<()> {
tracing_subscriber::fmt().init();

// todo need inmprove the args parsing
let args: Vec<String> = std::env::args().collect();
let (mount_point, mount_from, config_path) = match args.len() {
4 => (args[1].clone(), args[2].clone(), args[3].clone()),
_ => {
error!("Usage: {} <mount_point> <mount_from> <config>", args[0]);
return Err(Errno::from(libc::EINVAL));
}
};

//todo(read config file from args)
let config = AppConfig::from_file(Some("conf/gvfs_fuse.toml"));
let config = AppConfig::from_file(Some(&config_path));
if let Err(e) = &config {
error!("Failed to load config: {:?}", e);
return Err(Errno::from(libc::EINVAL));
}
let config = config.unwrap();
let mount_point = "gvfs";
let mount_from = "gvfs://fileset/test/c1/s1/fileset1";
let handle = tokio::spawn(async move {
let result = gvfs_mount(mount_point, mount_from, &config).await;
let result = gvfs_mount(&mount_point, &mount_from, &config).await;
if let Err(e) = result {
error!("Failed to mount gvfs: {:?}", e);
return Err(Errno::from(libc::EINVAL));
Expand Down

0 comments on commit 50f1931

Please sign in to comment.