Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component and stack completion support #992

Merged
merged 20 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0271842
Initial component and stack completion support
samtholiya Jan 30, 2025
4538d81
Merge branch 'main' into feature/dev-1780-shell-tab-completion
osterman Jan 31, 2025
3902a35
Merge branch 'main' into feature/dev-1780-shell-tab-completion
samtholiya Feb 2, 2025
f46f7a5
error log fixed
samtholiya Feb 2, 2025
4e305f3
Merge branch 'main' of https://github.com/cloudposse/atmos into featu…
samtholiya Feb 3, 2025
2f18b41
update list functions
samtholiya Feb 3, 2025
71c489a
Merge branch 'main' into feature/dev-1780-shell-tab-completion
samtholiya Feb 4, 2025
9cb116d
Fixed list component and stack test cases
samtholiya Feb 4, 2025
5612f60
add testcase for tab completion
samtholiya Feb 4, 2025
9d6a070
Merge branch 'main' of https://github.com/cloudposse/atmos into featu…
samtholiya Feb 7, 2025
eec991e
fix suggestions
samtholiya Feb 7, 2025
e5cb294
add completion doc
samtholiya Feb 7, 2025
f0bd5ef
fix completion typo
samtholiya Feb 7, 2025
c9edd24
updated doc
samtholiya Feb 8, 2025
28efab3
Apply suggestions from code review
osterman Feb 10, 2025
95eaff4
Merge branch 'main' into feature/dev-1780-shell-tab-completion
osterman Feb 11, 2025
bbca500
Merge branch 'main' into feature/dev-1780-shell-tab-completion
osterman Feb 11, 2025
ea384ac
Merge branch 'main' into feature/dev-1780-shell-tab-completion
aknysh Feb 11, 2025
6ea399d
Merge branch 'main' into feature/dev-1780-shell-tab-completion
samtholiya Feb 11, 2025
1d099b3
Merge branch 'main' into feature/dev-1780-shell-tab-completion
aknysh Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/list/list_components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func TestListComponentsWithStack(t *testing.T) {

output, err := FilterAndListComponents(testStack, stacksMap)
assert.Nil(t, err)
assert.Nil(t, err)
assert.NotNil(t, output)
assert.Greater(t, len(output), 0)
assert.ObjectsAreEqualValues([]string{"infra/vpc", "mixin/test-1", "mixin/test-2", "test/test-component", "test/test-component-override", "test/test-component-override-2", "test/test-component-override-3", "top-level-component1", "vpc", "vpc/new"}, output)
Expand Down
58 changes: 58 additions & 0 deletions website/docs/cli/commands/completion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,64 @@ When the generated completion script is loaded into the shell, pressing the tab
Run `atmos completion --help` to see all the available options
:::


osterman marked this conversation as resolved.
Show resolved Hide resolved
## Zsh Completion Setup
samtholiya marked this conversation as resolved.
Show resolved Hide resolved

To enable tab completion for Atmos in `Zsh`, add the following to your `~/.zshrc`:

```zsh
# Initialize Zsh completion system
autoload -Uz compinit && compinit

# Enable Atmos CLI completion
source <(atmos completion zsh)

# Improve completion behavior
zstyle ':completion:*' menu select # Enable menu selection
zstyle ':completion:*' force-list always # Force vertical menu listing

# Ensure the Tab key triggers autocompletion
bindkey '\t' expand-or-complete
```

After saving the file, apply the changes by running:

```zsh
source ~/.zshrc
```

Now, pressing `<Tab>` after atmos will display available subcommands.

If completions do not work, try regenerating the completion cache:

```zsh
rm -f ~/.zcompdump; compinit
```

## Bash Completion Setup

To enable tab completion for Atmos in `bash`, follow the steps given bellow

1. execute and capture the autocompletion script
```bash
atmos completion bash &> ~/.atmos_completion.sh
```
2. add the permissions
```bash
chmod +x ~/.atmos_completion.sh
```
3. Add the following line to your `.bashrc`
```bash
source ~/.atmos_completion.sh
```
4. After saving the file, apply the changes by running:

```zsh
source ~/.bashrc
```
Now, pressing `<Tab>` after atmos will display available subcommands.


### Examples

```shell
Expand Down
Loading