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
{{ message }}
Repository navigation
Shell / Tab completion for atmos stacks and components #45
I did notice there is a new completion subcommand.
⨠ eval $(atmos completion bash)
⨠ atmos<tab>
completion (generate the autocompletion script for the specified shell)
describe (describe)
helmfile (helmfile command)
help (Help about any command)
terraform (terraform command)
version (version command)
Yeah, I just realized I only implemented the base-level (atmos commands) and not stack completion. Figuring out how to do that will be a bit more tricky.
I think this would be even easier if we had a command for atmos list where users can list the stacks, components, and variables associated with each stack. We could repurpose this function to provide some autocompletion for the command line parameters like you mentioned. In the meantime, would something like the following be suitable for the terraform options?
varvalidArgs= []string{"init", "plan", "apply", "deploy", "destroy", "state", "import"} // and more as needed// terraformCmd represents the base command for all terraform sub-commandsvarterraformCmd=&cobra.Command{
Use: "terraform",
Aliases: []string{"tf"},
Short: "Execute Terraform commands",
Long: `This command executes Terraform commands`,
FParseErrWhitelist: struct{ UnknownFlagsbool }{UnknownFlags: true},
ValidArgs: validArgs,
Run: func(cmd*cobra.Command, args []string) {
which produces the following:
❯ atmos terraform <tab>generate -- Execute 'terraform generate' commandsapply deploy destroy dns-delegated-move import init plan state
This pr will only add completions for atmos inbuilt command, stack names and components
For custom commands we will have to
Fix the issue that shadows commands in case custom command includes a command that atmos already has DEV-469
We will have to probably modify the completion script that is generate so that it always defaults to dynamic suggestion instead of static suggestions that it stores for efficiency. So that we always read the config to suggest the commands
Activity
nitrocode commentedon Dec 27, 2021
I did notice there is a new
completionsubcommand.This seems to be off
That should show plan/apply/deploy/destroy
This returns a
-when hitting tab instead of showing the list of componentsThis returns another
-when it should show the list of stacks[-]Tab completion[/-][+]Shell / Tab completion[/+]nitrocode commentedon Nov 16, 2022
Matt Calhoun (@mcalhoun)
I reopened this ticket because I was hoping we could do something like this
mcalhoun commentedon Nov 16, 2022
Yeah, I just realized I only implemented the base-level (atmos commands) and not stack completion. Figuring out how to do that will be a bit more tricky.
nitrocode commentedon May 10, 2024
"real" (not abstract) component completion and root stack completion would be very handy here.
I also noticed that subcommands are missing.
I was expecting
plan,deploy,apply, etcHere's a way to get all the stacks using
yqAn even easier way is using it natively in atmos
Here's how to get all the real components using
yq[-]Shell / Tab completion[/-][+]Shell / Tab completion for atmos stacks and components[/+]RoseSecurity commentedon Nov 13, 2024
I think this would be even easier if we had a command for
atmos listwhere users can list the stacks, components, and variables associated with each stack. We could repurpose this function to provide some autocompletion for the command line parameters like you mentioned. In the meantime, would something like the following be suitable for theterraformoptions?which produces the following:
samtholiya commentedon Feb 4, 2025
#959
This pr will only add completions for atmos inbuilt command, stack names and components
For custom commands we will have to