You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- disables default `completion` cobra sub-command
- adds a `--completion [bash|zsh|fish]` flag which will generate shell completions using cobra's built-in support
- adds `installShellCompletion` to the `treefmt` package (this will need added to the nixpkgs entry after release)
The completions are static and address the first half of #529.
Signed-off-by: Brian McGee <[email protected]>
Copy file name to clipboardexpand all lines: docs/content/getting-started/usage.md
+11
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ Flags:
14
14
--allow-missing-formatter Do not exit with error if a configured formatter is missing. (env $TREEFMT_ALLOW_MISSING_FORMATTER)
15
15
--ci Runs treefmt in a CI mode, enabling --no-cache, --fail-on-change and adjusting some other settings best suited to a CI use case. (env $TREEFMT_CI)
16
16
-c, --clear-cache Reset the evaluation cache. Use in case the cache is not precise enough. (env $TREEFMT_CLEAR_CACHE)
17
+
--completion string [bash|zsh|fish] Generate shell completion scripts for the specified shell.
17
18
--config-file string Load the config file from the given path (defaults to searching upwards for treefmt.toml or .treefmt.toml).
18
19
--cpu-profile string The file into which a cpu profile will be written. (env $TREEFMT_CPU_PROFILE)
19
20
--excludes strings Exclude files or directories matching the specified globs. (env $TREEFMT_EXCLUDES)
@@ -126,6 +127,16 @@ in
126
127
flake.defaultNix
127
128
```
128
129
130
+
## Shell Completion
131
+
132
+
To generate completions for your preferred shell:
133
+
134
+
```console
135
+
❯ treefmt --completion bash
136
+
❯ treefmt --completion fish
137
+
❯ treefmt --completion zsh
138
+
```
139
+
129
140
## CI integration
130
141
131
142
We recommend using the [CI option](./configure.md#ci) in continuous integration environments.
0 commit comments