Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix typos #257

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <PATH> value notation
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
```
Expand Down Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions examples/options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
# @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() {
:;
}

# @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() {
Expand Down
10 changes: 5 additions & 5 deletions src/compgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ pub fn compgen(
}

if !argc_variables.is_empty() {
let mut prepend_candicates: IndexMap<String, (String, bool, CompColor)> = argc_variables
let mut prepend_candidates: IndexMap<String, (String, bool, CompColor)> = 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<CandidateValue> = candidates
Expand Down Expand Up @@ -567,7 +567,7 @@ impl CompColor {
Self { code, style }
}

pub(crate) fn deser(s: &str) -> Result<Self> {
pub(crate) fn parse(s: &str) -> Result<Self> {
if let Some((code, style)) = s.split_once(',') {
if let (Ok(code), Ok(style)) = (code.parse(), style.parse()) {
return Ok(Self::new(code, style));
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
6 changes: 3 additions & 3 deletions src/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})
}
}
Expand Down Expand Up @@ -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(),
})
}
}
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/compgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ abc() { :; }
}

#[test]
fn mult_char() {
fn multi_char() {
let script = r#"
# @option --oa*,[`_choice_fn`]
_choice_fn() {
Expand All @@ -742,7 +742,7 @@ _choice_fn() {
}

#[test]
fn mult_char2() {
fn multi_char2() {
let script = r#"
# @option --oa*,[`_choice_fn`]
_choice_fn() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ prog cmda -o file1

OUTPUT
command cat >&2 <<-'EOF'
error: invalid values for `--od <FILE> <FILE>`
error: invalid value for `--od <FILE> <FILE>`

USAGE: prog cmda [OPTIONS]

Expand Down