Skip to content

Commit

Permalink
Merge pull request #1967 from jqnatividad/qsv-completions
Browse files Browse the repository at this point in the history
`contrib(completions)`: add qsv multi-shell completions foundation

Awesome, merging it then...
  • Loading branch information
jqnatividad authored Jul 14, 2024
2 parents 5b5ed3e + 769ecd0 commit 6cc38a2
Show file tree
Hide file tree
Showing 18 changed files with 922 additions and 0 deletions.
1 change: 1 addition & 0 deletions contrib/completions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
215 changes: 215 additions & 0 deletions contrib/completions/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions contrib/completions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "qsv-clap-completions"
version = "0.1.0"
edition = "2021"

[dependencies]
clap = "4.5.9"
clap_complete = "4.5.8"
clap_complete_fig = "4.5.1"
clap_complete_nushell = "4.5.2"
39 changes: 39 additions & 0 deletions contrib/completions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# qsv completions - bash, zsh, fish, powershell, nushell, fig, elvish

Generate shell completions for qsv including the following shells:

- bash
- zsh
- powershell
- fish
- nushell
- fig
- elvish

There is potential to move this into a `qsv completions` command and/or add it as a feature since clap and several clap-related crates may need to be installed. Also this is currently a manual effort to keep commands up to date.

> Status: Based on qsv v0.129.0. Not all commands are available. See src/cmd for available commands.
## Usage

To generate completions for all shells into an examples folder run the `generate_examples.bash` script:

```bash
bash generate_examples.bash
```

To generate a completion manually run:

```bash
cargo run -- <shell>
```

Replace `<shell>` with any of the shells mentioned above.

The completions output should be printed to your terminal. You may redirect this to a file. For example for Bash completions:

```bash
cargo run -- bash > completions.bash
```

Then run them as your shell intends it to be ran.
Loading

0 comments on commit 6cc38a2

Please sign in to comment.