Skip to content

Commit 0459c31

Browse files
authored
Document command autocompletion functionality (#39)
1 parent b42ac71 commit 0459c31

File tree

2 files changed

+72
-3
lines changed

2 files changed

+72
-3
lines changed

AUTOCOMPLETION.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Autocompletion
2+
3+
This guide describes how you can enable command autocompletion for the STACKIT CLI by leveraging the functionality provided the [Cobra](https://github.com/spf13/cobra) framework.
4+
5+
The process may vary depending on the type of shell you are using and your operating system (OS).
6+
7+
You will need to start a new shell for the setup to take effect.
8+
9+
## bash
10+
11+
This process depends on the `bash-completion` package. If you don't have it installed already, you can install it via your OS's package manager.
12+
13+
#### Linux
14+
15+
```shell
16+
stackit completion bash > /etc/bash_completion.d/stackit
17+
```
18+
19+
#### macOS
20+
21+
```shell
22+
stackit completion bash > $(brew --prefix)/etc/bash_completion.d/stackit
23+
```
24+
25+
## zsh
26+
27+
If shell completion is not already enabled in your environment you will need to enable it by executing the following once:
28+
29+
```shell
30+
echo "autoload -U compinit; compinit" >> ~/.zshrc
31+
```
32+
33+
#### Linux
34+
35+
```shell
36+
stackit completion zsh > "${fpath[1]}/_stackit"
37+
```
38+
39+
#### macOS
40+
41+
```shell
42+
stackit completion zsh > $(brew --prefix)/share/zsh/site-functions/_stackit
43+
```
44+
45+
Additionaly, you might also need to run:
46+
47+
```shell
48+
source $(brew --prefix)/share/zsh/site-functions/_stackit >> ~/.zshrc
49+
```
50+
51+
## PowerShell
52+
53+
You can load completions for your current shell session by running:
54+
55+
```shell
56+
stackit completion powershell | Out-String | Invoke-Expression
57+
```
58+
59+
To load completions for every new session, add the output of the above command to your PowerShell profile.
60+
61+
## fish
62+
63+
```shell
64+
stackit completion fish > ~/.config/fish/completions/stackit.fish
65+
```

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Your feedback is appreciated!
77

88
## Installation
99

10-
Please refer to our [installation](./INSTALLATION.md) guide for instructions on how to install and get started using the STACKIT CLI.
10+
Please refer to our [installation guide](./INSTALLATION.md) for instructions on how to install and get started using the STACKIT CLI.
1111

1212
## Usage
1313

@@ -65,7 +65,7 @@ To authenticate using a service account, run:
6565
$ stackit auth activate-service-account
6666
```
6767

68-
For more details on how to setup authentication using a service account, check our [Authentication guide](./AUTHENTICATION.md)
68+
For more details on how to setup authentication using a service account, check our [authentication guide](./AUTHENTICATION.md).
6969

7070
## Configuration
7171

@@ -97,13 +97,17 @@ $ stackit config list
9797

9898
You can also edit the configuration file manually.
9999

100+
## Autocompletion
101+
102+
If you wish to setup command autocompletion in your shell for the STACKIT CLI, please refer to our [autocompletion guide](./AUTOCOMPLETION.md).
103+
100104
## Reporting issues
101105

102106
If you encounter any issues or have suggestions for improvements, please reach out to the Developer Tools team or open a ticket through the [STACKIT Help Center](https://support.stackit.cloud/).
103107

104108
## Contribute
105109

106-
Your contribution is welcome! For more details on how to contribute, refer to our [Contribution Guide](./CONTRIBUTION.md).
110+
Your contribution is welcome! For more details on how to contribute, refer to our [contribution guide](./CONTRIBUTION.md).
107111

108112
## License
109113

0 commit comments

Comments
 (0)