Skip to content

Shell completion#9

Open
sahinf wants to merge 2 commits intoflu0r1ne:mainfrom
sahinf:main
Open

Shell completion#9
sahinf wants to merge 2 commits intoflu0r1ne:mainfrom
sahinf:main

Conversation

@sahinf
Copy link

@sahinf sahinf commented Mar 22, 2025

Since this project already uses clap, it can leverage clap_complete to automatically generate completions for any shell. LMK if you'd be open to it.

I also added help text to opts color and config
screenshot_2025-03-21_20-42-46_098262399
screenshot_2025-03-21_20-44-02_494942001

The first commit can be culled but the names make more sense to me.

sahinf added 2 commits March 21, 2025 19:21
Struct Cli represents the options for clap so call it Opts.
Also ChatArgs define chat options
The cli package `clap` supports automated shell completion generation
through augment project `clap_complete`. With these changes, completions
can be generated for the shells supported by `clap_complete` using the
`--generate` flag.

The flag is exclusive and can also, itself, be hidden from completions
by adding `hide = true` k/v into the arg attribute
```rust
\#[arg(help = "Specify alternative config path", long)]
```

also run `cargo fmt`

https://docs.rs/clap_complete/latest/clap_complete/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant