Skip to content

Commit

Permalink
document completion generation
Browse files Browse the repository at this point in the history
  • Loading branch information
tertsdiepraam committed Dec 14, 2023
1 parent 65e456c commit 9f55e50
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/guide/completions.md
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
# Completions

Shell completions and documentation can be generated automatically by this crate. The implementation for this is in the [`uutils-args-complete`] crate. The easiest way of generating completions is via the `parse-is-complete` feature flag. This feature flag hijacks the [`Options::parse`](crate::Options::parse) function to print completions. This means that there is usually no need to write any additional code to generate completions.

```bash
cargo run --features parse-is-complete -- [shell]
```

The `[shell]` value here can be `fish`, `zsh`, `bash`, `powershell`, `elvish` or `nu`.

> **Note**: Some of these remain unimplemented as of writing.
Additionally, the values `man` or `md` can be passed to generate man pages and markdown documentation (for `mdbook`).

If you do not want to hijack the [`Options::parse`](crate::Options::parse) function, you can instead enable the `complete` feature flag. This makes the `Options::complete` function available in addition to the [`Options::parse`](crate::Options::parse) function to generate a `String` with the completion.

0 comments on commit 9f55e50

Please sign in to comment.