google / google/argh

`argh-complete` approach could be simplified (like in `clap`)

Open
#231 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
102
PR merge metrics
No merged PRs in 30d

Description

In `clap`, you can do like this:

```rust
use clap_complete::{generate, Shell};

let mut cmd = MyArgs::command(); // a simple way to get a command name
let shell: Shell = args.shell.into(); // a custom `--shell` arg into `Shell`
generate(shell, &mut cmd, "adi", &mut io::stdout()); // boom!
```

You [completion_example.rs](https://github.com/google/argh/blob/master/argh/examples/completion_example.rs) looks more complex, but **it's only one step away.**

1. Add `MyArgs::command()`.
2. Add `Shell` type.
3. Add auto-dispatch `argh_complete::generate()`.

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.