From dcdcb226f9713b889e743cd5fd55453591f41624 Mon Sep 17 00:00:00 2001 From: sigoden Date: Fri, 3 Nov 2023 07:18:09 +0800 Subject: [PATCH] chore: fix typos --- README.md | 16 ++++++++-------- examples/options.sh | 6 +++--- src/compgen.rs | 10 +++++----- src/matcher.rs | 2 +- src/param.rs | 6 +++--- tests/compgen.rs | 4 ++-- ...nap => integration__compgen__multi_char.snap} | 0 ...ap => integration__compgen__multi_char2.snap} | 0 ...ration__validate__option_mismatch_values.snap | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) rename tests/snapshots/{integration__compgen__mult_char.snap => integration__compgen__multi_char.snap} (100%) rename tests/snapshots/{integration__compgen__mult_char2.snap => integration__compgen__multi_char2.snap} (100%) diff --git a/README.md b/README.md index 37dcede4..600da566 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Define a positional argument. ```sh # @arg va -# @arg vb! requird +# @arg vb! required # @arg vc* multiple # @arg vd+ required + multiple # @arg vna value notation @@ -127,7 +127,7 @@ Define a positional argument. # @arg vfa[`_choice_fn`] choice from fn # @arg vfb[?`_choice_fn`] choice from fn + no validation # @arg vfc*[`_choice_fn`] multiple + choice from fn -# @arg vx~ capture all remaing args +# @arg vx~ capture all remaining args ``` ### @option @@ -157,7 +157,7 @@ Define a option. # @option --ofa[`_choice_fn`] choice from fn # @option --ofb[?`_choice_fn`] choice from fn + no validation # @option --ofc*[`_choice_fn`] multi-occurs + choice from fn -# @option --oxa~ capture all remaing args +# @option --oxa~ capture all remaining args ``` ### @flag @@ -171,8 +171,8 @@ Define a flag. A flag is an option of boolean type, and is always false by defau ```sh # @flag --fa -# @flag -b --fb shoft -# @flag -c shoft only +# @flag -b --fb short +# @flag -c short only # @flag --fd* multi-occurs # @flag -e --fe* short + multi-occurs ``` @@ -291,7 +291,7 @@ Argc can be used as multiple shell completion engine. see [argc-completions](htt ## Argcscript -Argc will automatically find and run `Argcfile.sh` unless `--argc-*` options are used to change this behaviour. +Argc will automatically find and run `Argcfile.sh` unless `--argc-*` options are used to change this behavior. Argcfile is to argc what Makefile is to make. @@ -302,7 +302,7 @@ what is the benefit? - As a centralized entrypoint/document for executing the project's bash scripts. - Serves as a script for a task runner. -You can use `argc --argc-create` to quickly create boilerplate Argcscripts. For example: +You can use `argc --argc-create` to quickly create a boilerplate argcscript. For example: ``` argc --argc-create test build run @@ -318,7 +318,7 @@ argc provides features for running commands/functions in parallel. argc --argc-parallel "$0" cmd1 arg1 arg2 ::: cmd2 ``` -The above command will run `cmd1 arg1 arg2` and `cmd2` in parellel. Functions running in parallel mode can still access the `argc_*` variable. +The above command will run `cmd1 arg1 arg2` and `cmd2` in parallel. Functions running in parallel mode can still access the `argc_*` variable. ## Windows Only diff --git a/examples/options.sh b/examples/options.sh index 4a708e5d..5c9a7636 100755 --- a/examples/options.sh +++ b/examples/options.sh @@ -18,7 +18,7 @@ # @option --ofa[`_choice_fn`] choice from fn # @option --ofb[?`_choice_fn`] choice from fn + no validation # @option --ofc*[`_choice_fn`] multi-occurs + choice from fn -# @option --oxa~ capture all remaing args +# @option --oxa~ capture all remaining args options() { :; } @@ -26,8 +26,8 @@ options() { # @cmd # @describe All kind of flags # @flag --fa -# @flag -b --fb shoft -# @flag -c shoft only +# @flag -b --fb short +# @flag -c short only # @flag --fd* multi-occurs # @flag -e --fe* short + multi-occurs flags() { diff --git a/src/compgen.rs b/src/compgen.rs index c6fec70f..ced88d3e 100644 --- a/src/compgen.rs +++ b/src/compgen.rs @@ -172,12 +172,12 @@ pub fn compgen( } if !argc_variables.is_empty() { - let mut prepend_candicates: IndexMap = argc_variables + let mut prepend_candidates: IndexMap = argc_variables .into_iter() .map(|value| (value, (String::new(), false, CompColor::of_value()))) .collect(); - prepend_candicates.extend(candidates); - candidates = prepend_candicates; + prepend_candidates.extend(candidates); + candidates = prepend_candidates; } let mut candidates: Vec = candidates @@ -567,7 +567,7 @@ impl CompColor { Self { code, style } } - pub(crate) fn deser(s: &str) -> Result { + pub(crate) fn parse(s: &str) -> Result { if let Some((code, style)) = s.split_once(',') { if let (Ok(code), Ok(style)) = (code.parse(), style.parse()) { return Ok(Self::new(code, style)); @@ -1013,7 +1013,7 @@ fn parse_candidate_value(input: &str) -> CandidateValue { if parts_len >= 2 { if let Some(color) = parts[1] .strip_prefix("/color:") - .and_then(|v| CompColor::deser(v).ok()) + .and_then(|v| CompColor::parse(v).ok()) { comp_color = color; description = parts[2..].join("\t"); diff --git a/src/matcher.rs b/src/matcher.rs index a7e92894..6bce4d8e 100644 --- a/src/matcher.rs +++ b/src/matcher.rs @@ -805,7 +805,7 @@ impl<'a, 'b> Matcher<'a, 'b> { let (cmd, cmd_paths) = self.get_cmd_and_paths(*level); let usage = cmd.render_usage(&cmd_paths); format!( - r###"error: invalid values for `{value}` + r###"error: invalid value for `{value}` {usage} diff --git a/src/param.rs b/src/param.rs index b74f446a..1558784a 100644 --- a/src/param.rs +++ b/src/param.rs @@ -328,7 +328,7 @@ impl FlagOptionParam { "value_names": self.value_names, "modifier": self.data.modifer, "choices": self.data.choice_values(), - "default": self.data.defualt_value(), + "default": self.data.default_value(), }) } } @@ -459,7 +459,7 @@ impl PositionalParam { "describe": self.describe, "modifier": self.data.modifer, "choices": self.data.choice_values(), - "default": self.data.defualt_value(), + "default": self.data.default_value(), }) } } @@ -521,7 +521,7 @@ impl ParamData { } } - pub(crate) fn defualt_value(&self) -> Option<&String> { + pub(crate) fn default_value(&self) -> Option<&String> { match &self.default { Some(DefaultData::Value(v)) => Some(v), _ => None, diff --git a/tests/compgen.rs b/tests/compgen.rs index 5086c4c7..fc8f08f6 100644 --- a/tests/compgen.rs +++ b/tests/compgen.rs @@ -730,7 +730,7 @@ abc() { :; } } #[test] -fn mult_char() { +fn multi_char() { let script = r#" # @option --oa*,[`_choice_fn`] _choice_fn() { @@ -742,7 +742,7 @@ _choice_fn() { } #[test] -fn mult_char2() { +fn multi_char2() { let script = r#" # @option --oa*,[`_choice_fn`] _choice_fn() { diff --git a/tests/snapshots/integration__compgen__mult_char.snap b/tests/snapshots/integration__compgen__multi_char.snap similarity index 100% rename from tests/snapshots/integration__compgen__mult_char.snap rename to tests/snapshots/integration__compgen__multi_char.snap diff --git a/tests/snapshots/integration__compgen__mult_char2.snap b/tests/snapshots/integration__compgen__multi_char2.snap similarity index 100% rename from tests/snapshots/integration__compgen__mult_char2.snap rename to tests/snapshots/integration__compgen__multi_char2.snap diff --git a/tests/snapshots/integration__validate__option_mismatch_values.snap b/tests/snapshots/integration__validate__option_mismatch_values.snap index b3368606..89388f7b 100644 --- a/tests/snapshots/integration__validate__option_mismatch_values.snap +++ b/tests/snapshots/integration__validate__option_mismatch_values.snap @@ -7,7 +7,7 @@ prog cmda -o file1 OUTPUT command cat >&2 <<-'EOF' -error: invalid values for `--od ` +error: invalid value for `--od ` USAGE: prog cmda [OPTIONS]