This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 30483104 feat: improve the readability of oli command line error 
output (#2016)
30483104 is described below

commit 3048310415c1ec849ee81b94901b284c0fbc0347
Author: czybjtu <[email protected]>
AuthorDate: Mon Apr 17 14:39:14 2023 +0800

    feat: improve the readability of oli command line error output (#2016)
    
    Signed-off-by: czybjtu <[email protected]>
---
 bin/oli/src/bin/oli.rs | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/bin/oli/src/bin/oli.rs b/bin/oli/src/bin/oli.rs
index 779cea3f..56e281e3 100644
--- a/bin/oli/src/bin/oli.rs
+++ b/bin/oli/src/bin/oli.rs
@@ -37,15 +37,19 @@ fn new_cmd(name: &'static str) -> Result<Command> {
     let d = config_dir().ok_or_else(|| anyhow!("unknown config dir"))?;
     let default_config_path = d.join("oli/config.toml").as_os_str().to_owned();
 
-    Ok(Command::new(name).version(env!("CARGO_PKG_VERSION")).arg(
-        Arg::new("config")
-            .long("config")
-            .help("Path to the config file")
-            .global(true)
-            .default_value(default_config_path)
-            .value_parser(value_parser!(PathBuf))
-            .required(false),
-    ))
+    Ok(Command::new(name)
+        .version(env!("CARGO_PKG_VERSION"))
+        .arg(
+            Arg::new("config")
+                .long("config")
+                .help("Path to the config file")
+                .global(true)
+                .default_value(default_config_path)
+                .value_parser(value_parser!(PathBuf))
+                .required(false),
+        )
+        .subcommand_required(true)
+        .arg_required_else_help(true))
 }
 
 #[tokio::main]

Reply via email to