From 546cf0474276fdbac0c1680551173317d0bed889 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 23 Nov 2023 13:28:21 +0900 Subject: [PATCH] improve --help output --- v2/src/cli.rs | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/v2/src/cli.rs b/v2/src/cli.rs index e4ac583..e59af0c 100644 --- a/v2/src/cli.rs +++ b/v2/src/cli.rs @@ -58,18 +58,23 @@ impl Default for Options { } impl Options { - const USAGE: &'static str = r#" - Usage: shiba [options...] [PATH...] + const USAGE: &'static str = r#"Usage: shiba [OPTIONS...] [PATH...] - Options: - -t, --theme THEME Window theme ("dark", "light" or "system") - --no-watch Disable to watch file changes - --generate-config-file Generate the default config file overwriting an existing file - --config-dir PATH Custom the config directory path - --data-dir PATH Custom the data directory path - --debug Enable debug features - -h, --help Print this help - "#; +Shiba is a markdown preview application to be used with your favorite text +editor, designed for simplicity, performance, and keyboard-friendliness. + +Options: + -t, --theme THEME Window theme ("dark", "light" or "system") + --no-watch Disable to watch file changes + --generate-config-file Generate the default config file overwriting an existing file + --config-dir PATH Change the config directory path + --data-dir PATH Change the application data directory path + --debug Enable debug features + -h, --help Print this help + +Document: + https://github.com/rhysd/Shiba/v2/README.md +"#; pub fn parse(args: impl Iterator) -> Result { use lexopt::prelude::*; @@ -220,9 +225,7 @@ mod tests { fn help_option() { match Options::parse(cmdline(&["--help"])).unwrap() { Parsed::Options(opts) => panic!("--help is not recognized: {opts:?}"), - Parsed::Help(help) => { - assert!(help.contains("Usage: shiba [options...] [PATH...]"), "{help:?}") - } + Parsed::Help(help) => assert_eq!(help, Options::USAGE), } }