diff --git a/README.md b/README.md index 7f2091b..34b3789 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ List registered remote hosts. ```shell mdrs config list -mdrs config list -l +mdrs config ls ``` ### config delete @@ -62,6 +62,7 @@ Remove a registered remote host. ```shell mdrs config delete neurodata +mdrs config rm neurodata ``` ### login diff --git a/src/commands/config.rs b/src/commands/config.rs index bc723a3..6d56692 100644 --- a/src/commands/config.rs +++ b/src/commands/config.rs @@ -100,7 +100,7 @@ pub fn config_update(remote: &str, url: &str) -> Result<(), Box Result<(), Box> { +pub fn config_list() -> Result<(), Box> { let path = config_path(); if !path.exists() { return Ok(()); @@ -114,12 +114,8 @@ pub fn config_list(long: bool) -> Result<(), Box> { if sec == "default" { continue; } - if !long { - println!("{}:", sec); - } else { - let url = props.get("url").and_then(|v| v.clone()).unwrap_or_default(); - println!("{}:\t{}", sec, url); - } + let url = props.get("url").and_then(|v| v.clone()).unwrap_or_default(); + println!("{}:\t{}", sec, url); } Ok(()) } diff --git a/src/commands/config_subcommand.rs b/src/commands/config_subcommand.rs index 8252989..a4090e7 100644 --- a/src/commands/config_subcommand.rs +++ b/src/commands/config_subcommand.rs @@ -7,8 +7,10 @@ pub enum ConfigSubcommand { /// Update an existing remote host Update(ConfigUpdateArgs), /// List all remote hosts + #[command(alias = "ls")] List(ConfigListArgs), /// Delete a remote host + #[command(aliases = ["remove", "rm"])] Delete(ConfigDeleteArgs), } @@ -25,10 +27,7 @@ pub struct ConfigUpdateArgs { } #[derive(Args, Debug)] -pub struct ConfigListArgs { - #[arg(short, long)] - pub long: bool, -} +pub struct ConfigListArgs {} #[derive(Args, Debug)] pub struct ConfigDeleteArgs { diff --git a/src/main.rs b/src/main.rs index ee4d32e..daa0764 100644 --- a/src/main.rs +++ b/src/main.rs @@ -161,8 +161,8 @@ fn main() { handle_error(e); } } - ConfigSubcommand::List(args) => { - if let Err(e) = crate::commands::config::config_list(args.long) { + ConfigSubcommand::List(_) => { + if let Err(e) = crate::commands::config::config_list() { handle_error(e); } }