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

Enabling Autocompletion for Custom CLI commands #438

Open
RoseSecurity opened this issue Oct 14, 2023 · 0 comments
Open

Enabling Autocompletion for Custom CLI commands #438

RoseSecurity opened this issue Oct 14, 2023 · 0 comments
Labels
enhancement New feature or request UpWork

Comments

@RoseSecurity
Copy link
Member

Describe the Feature

Would it be possible to enable autocompletion for custom CLI parameters passed into atmos.yaml?

This would allow for adding a complete section to atmos.yaml so that custom commands can be autocompleted. An example of this would be by adding the following to atmos.yaml:

complete:
  enable: true
  fuzzyMatching: true

Where we could define completeFunctions to dynamically fetch data for autocompletion and attach functions to arguments/flags

# Functions to complete on
completeFunctions:
  - name: components
    exec:
      - atmos list components
    
# Attach to function
  - name: describe
    description: Execute 'describe' commands
    # subcommands
    commands:
      - name: k8s-upgrade
        description: "Describe the steps on how to upgrade an EKS cluster to the next Kubernetes version. Usage: atmos describe k8s-upgrade <eks_component> -s <stack>"
        arguments:
          - name: component
            description: Name of the EKS component
              complete:
                - components

Maybe this could be achieved by doing something similar to:

	if cfg.Complete.Enable {
		cobra.EnableCommandNameCompletion = true
		cobra.EnableCommandNameFuzzyMatching = cfg.Complete.AutoFuzzing
	}

Expected Behavior

An example command would be:

atmos describe component ...

where the ... would autocomplete

Use Case

This feature is just for ease of use and quality of life improvements.

Describe Ideal Solution

Whichever way is the easiest and most painless way to implement.

Alternatives Considered

Not sure if it is easier to incorporate into a custom atmos.yaml file.

Additional Context

No response

@osterman osterman added the enhancement New feature or request label Feb 3, 2024
@osterman osterman added the UpWork label Oct 11, 2024 — with Linear
@osterman osterman changed the title Enabling Autocompletion for Custom CLI Parameters Enabling Autocompletion for Custom CLI commands Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request UpWork
Projects
None yet
Development

No branches or pull requests

2 participants