Skip to content

Commit

Permalink
feat: improve default subcommand (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden authored Apr 13, 2024
1 parent 598d114 commit d3b3fcf
Show file tree
Hide file tree
Showing 7 changed files with 329 additions and 173 deletions.
11 changes: 11 additions & 0 deletions docs/task-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ main() {
}
```

Another way is to use `@meta default-subcommand`

```sh
# @cmd
# @meta default-subcommand
build() { :; }

# @cmd
test() { :; }
```

Remember, you can always use `--help` for detailed help information.

## Aliases
Expand Down
4 changes: 2 additions & 2 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ _argc_version{suffix}() {{

fn build_parse(cmd: &Command, suffix: &str) -> String {
let mut parse_help = {
let help_flags = cmd.help_flags().join(" | ");
let help_flags = cmd.help_flags.join(" | ");
format!(
r#"
{help_flags})
Expand All @@ -331,7 +331,7 @@ fn build_parse(cmd: &Command, suffix: &str) -> String {
)
};
let parse_version = if cmd.exist_version() {
let version_flags = cmd.version_flags().join(" | ");
let version_flags = cmd.version_flags.join(" | ");
format!(
r#"
{version_flags})
Expand Down
Loading

0 comments on commit d3b3fcf

Please sign in to comment.