Dev/olivierdubo/issues autocomplete#193
Open
duboolivier wants to merge 12 commits into
Open
Conversation
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
amstuta
reviewed
Jun 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds shell autocompletion support focused on improving UX for Public Cloud commands by completing --cloud-project values from the OVHcloud API, and introduces a ovhcloud completion install helper to persist completion setup in common shells.
Changes:
- Add a new
internal/completionpackage with an API-backed completion provider for--cloud-project. - Introduce a new top-level
completioncommand (bash/zsh/fish/powershell) pluscompletion install. - Register
--cloud-projectflag completion across manyovhcloud cloud ...subcommands.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/completion/completion.go | Implements API-backed completion suggestions for --cloud-project. |
| internal/cmd/completion.go | Adds ovhcloud completion generation and completion install workflow. |
| internal/cmd/cloud_user.go | Registers --cloud-project flag completion for cloud user. |
| internal/cmd/cloud_storage_swift.go | Registers --cloud-project flag completion for cloud storage swift. |
| internal/cmd/cloud_storage_object.go | Registers --cloud-project flag completion for cloud storage object. |
| internal/cmd/cloud_storage_file.go | Registers --cloud-project flag completion for cloud storage file. |
| internal/cmd/cloud_storage_block.go | Registers --cloud-project flag completion for cloud storage block. |
| internal/cmd/cloud_ssh_key.go | Registers --cloud-project flag completion for cloud ssh-key. |
| internal/cmd/cloud_savings_plan.go | Registers --cloud-project flag completion for cloud savings-plan. |
| internal/cmd/cloud_region.go | Registers --cloud-project flag completion for cloud region. |
| internal/cmd/cloud_reference.go | Registers --cloud-project flag completion for cloud reference. |
| internal/cmd/cloud_quota.go | Registers --cloud-project flag completion for cloud quota. |
| internal/cmd/cloud_project.go | Registers --cloud-project flag completion for cloud project. |
| internal/cmd/cloud_operation.go | Registers --cloud-project flag completion for cloud operation. |
| internal/cmd/cloud_network.go | Registers --cloud-project flag completion for cloud network. |
| internal/cmd/cloud_managed_registry.go | Registers --cloud-project flag completion for cloud managed-registry. |
| internal/cmd/cloud_managed_rancher.go | Registers --cloud-project flag completion for cloud managed-rancher. |
| internal/cmd/cloud_managed_kubernetes.go | Registers --cloud-project flag completion for cloud managed-kubernetes. |
| internal/cmd/cloud_managed_database.go | Registers --cloud-project flag completion for cloud managed-database. |
| internal/cmd/cloud_managed_analytics.go | Registers --cloud-project flag completion for cloud managed-analytics. |
| internal/cmd/cloud_loadbalancer.go | Registers --cloud-project flag completion for cloud loadbalancer. |
| internal/cmd/cloud_ip.go | Registers --cloud-project flag completion for cloud ip. |
| internal/cmd/cloud_instance.go | Registers --cloud-project flag completion for cloud instance. |
| internal/cmd/cloud_alerting.go | Registers --cloud-project flag completion for cloud alerting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
amstuta
reviewed
Jul 2, 2026
|
|
||
| result := make(chan []string, 1) | ||
| go func() { | ||
| ids, err := httpLib.FetchArray(endpoint, "") |
Collaborator
There was a problem hiding this comment.
here you must use FetchExpandedArray also
amstuta
reviewed
Jul 2, 2026
|
|
||
| // CloudProjects returns completion suggestions for the --cloud-project flag. | ||
| // Each suggestion is "projectID\tName" so shells can display the project name alongside. | ||
| func CloudProjects(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { |
Collaborator
There was a problem hiding this comment.
would it be possible to remove this func and replace by fetchIDSuggestions ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added shell autocompletion for the --cloud-project flag across all ovhcloud cloud subcommands. When pressing TAB after --cloud-project, the CLI queries the OVHcloud API and displays the list of available project IDs with their descriptions. A new ovhcloud completion install command automatically sets up completion in the user's shell (~/.bashrc or ~/.zshrc) without any manual configuration.
Fixes #xx (issue)
Type of change
Please delete options that are not relevant.
Checklist:
go mod tidy