Skip to content

Commit

Permalink
Homebrew: Automatically install shell completions for bash/zsh/fish (#…
Browse files Browse the repository at this point in the history
…352)

* Goreleaser/Homebrew: Install shell completions

* Use "stratus completion" instead of "stratus completions"

* Use "stratus" instead of "stratus-red-team" for basename for autocompletions

* Add docs on new autocompletion autoinstall

---------

Co-authored-by: Christophe Tafani-Dereeper <christophe.tafanidereeper@datadoghq.com>
  • Loading branch information
craSH and christophetd committed May 3, 2023
1 parent a44b693 commit 28461cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ brews:
url_template: "https://github.com/DataDog/stratus-red-team/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
license: Apache-2.0
homepage: "https://stratus-red-team.cloud"
install: |
bin.install "stratus"
# Install shell completions
generate_completions_from_executable(bin/"stratus", "completion", shells: [:bash, :fish, :zsh], base_name: "stratus")
archives:
- replacements:
darwin: Darwin
Expand Down
17 changes: 12 additions & 5 deletions docs/user-guide/commands/autocompletion.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@ title: CLI autocompletion

Stratus Red Team uses [cobra](https://github.com/spf13/cobra)'s built-in support to add autocompletions when working with the CLI.

## Sample usage

```bash
stratus deton[tab]
stratus detonate aws[tab][tab]
```
## Setup

### Through Homebrew

When installing Stratus Red Team through Homebrew, shell completions are automatically installed for bash, zsh and fish shells.

### Manually

=== "bash"

Ensure you have [bash-completion](https://github.com/scop/bash-completion) installed (`brew install bash-completion` / `apt install bash-completion`), then run:
Expand Down Expand Up @@ -47,9 +59,4 @@ Stratus Red Team uses [cobra](https://github.com/spf13/cobra)'s built-in support
stratus completion fish > ~/.config/fish/completions/stratus.fish
```

## Sample usage

```bash
stratus deton[tab]
stratus detonate aws[tab][tab]
```

0 comments on commit 28461cc

Please sign in to comment.