google / google/argh

Default subcommand

Open
#57 4 comments 10 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
102
PR merge metrics
No merged PRs in 30d

Description

Is it possible to make a default subcommand with `argh`? I want something like this:
```rust
#[derive(FromArgs, PartialEq, Debug)]
/// Top-level command.
struct TopLevel {
#[argh(subcommand)]
nested: Sub,
}

#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand)]
enum Sub {
#[argh(default)] // <-----
One(SubCommandOne),
Two(SubCommandTwo),
}

/* one and two subcommands*/
```
With
- `cmd one ...` resulting in `Sub::One(..)`
- `cmd two ...` resulting in `Sub::Two(..)`
- `cmd ...` resulting in `Sub::One(..)` (the default)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.