diff --git a/Cargo.lock b/Cargo.lock index 0ce146c..a66fa9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1021,7 +1021,7 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" [[package]] name = "mdrs-client-rust" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "base64", diff --git a/Cargo.toml b/Cargo.toml index 45c269c..19cf335 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mdrs-client-rust" -version = "0.1.0" +version = "0.1.1" edition = "2024" license = "MIT" authors = ["Neuroinformatics Unit, RIKEN CBS"] diff --git a/README.md b/README.md index 9130543..7f2091b 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,14 @@ mdrs file-metadata neurodata:/NIU/Repository/TEST/dataset/sample.dat mdrs file-metadata -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open/Readme.txt ``` +### version + +Show the tool name and version number. + +```shell +mdrs version +``` + ### help Show help for a command. diff --git a/src/commands/ls.rs b/src/commands/ls.rs index febeeb5..de2e485 100644 --- a/src/commands/ls.rs +++ b/src/commands/ls.rs @@ -14,7 +14,7 @@ pub async fn ls( password: Option<&str>, is_json: bool, is_recursive: bool, - is_quick: bool, + is_quiet: bool, ) -> Result<(), Box> { let (remote, labname, path) = parse_remote_path(remote_path)?; let cache = load_cache_with_token_refresh(&remote).await?; @@ -44,7 +44,7 @@ pub async fn ls( &files_sorted, folder.access_level_name(), &labname, - !is_quick, + !is_quiet, ); } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 1cade36..e957ae5 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -16,4 +16,5 @@ pub mod mv; pub mod rm; pub mod shared; pub mod upload; +pub mod version; pub mod whoami; diff --git a/src/commands/version.rs b/src/commands/version.rs new file mode 100644 index 0000000..1efc595 --- /dev/null +++ b/src/commands/version.rs @@ -0,0 +1,3 @@ +pub fn version() { + println!("{} {}", env!("CARGO_BIN_NAME"), env!("CARGO_PKG_VERSION")); +} diff --git a/src/main.rs b/src/main.rs index e97ba4a..8af4640 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,7 +62,7 @@ enum Commands { #[arg(short = 'r', long)] recursive: bool, #[arg(short = 'q', long)] - quick: bool, + quiet: bool, }, Whoami { remote: String, @@ -109,6 +109,8 @@ enum Commands { password: Option, remote_path: String, }, + /// Show the version of this tool + Version, } /// Print the error message in Python-compatible format and exit with code 2. @@ -249,7 +251,7 @@ fn main() { password, json, recursive, - quick, + quiet, } => { if let Err(e) = tokio::runtime::Runtime::new() .unwrap() @@ -258,7 +260,7 @@ fn main() { password.as_deref(), *json, *recursive, - *quick, + *quiet, )) { handle_error(e); @@ -356,5 +358,8 @@ fn main() { handle_error(e); } } + Commands::Version => { + commands::version::version(); + } } }