fix(completion): complete parent-ID slots for database and storage sub-resources - #241
Merged
Merged
Conversation
…ub-resources Database family: - completeDBaaSDatabaseID: was returning nil for args[0] (dbaas-id slot); now delegates to completeDBaaSID. Registered on database create and list, which had no ValidArgsFunction. - completeDBaaSUserID: same fix. Registered on user create and list. - completeGrantID: was returning nil for args[0] and args[1]; now delegates to completeDBaaSID ? completeDBaaSDatabaseID in order. Registered on all four grant commands (create, list, get, delete), none of which had ValidArgsFunction. Storage family: - storage backup create (storageBackupCmd): the positional [volume-id] arg had no completion; registered completeBlockStorageID. - storage restore create (storageRestoreCmd): [backup-id] [volume-id] args had no completion; added completeStorageRestoreCreateArgs which completes backup IDs at args[0] and block storage (volume) IDs at args[1]. Security family: no changes needed ? key and kmip resolve their KMS parent via --kms-id flag (already read in completeKeyID/completeKmipID), and all create/list commands in that family take no positional args. Tests: added coverage for all new delegation paths and too-many-args guards in completion_test.go. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #241 +/- ##
==========================================
+ Coverage 78.14% 78.20% +0.05%
==========================================
Files 53 53
Lines 12569 12593 +24
==========================================
+ Hits 9822 9848 +26
+ Misses 1576 1575 -1
+ Partials 1171 1170 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…resources Network resources (from #240): - subnet.md, securitygroup.md, vpcpeering.md: expand bare stubs into full examples showing parent-slot completion at args[0] and child-slot completion at args[1]. - securityrule.md, vpcpeeringroute.md: extend existing completion sections to show all three positional slots (were showing only the final slot). Database resources (from #241): - dbaas.database.md: add Shell Auto-completion section (dbaas-id ? database-name). - dbaas.user.md: add Shell Auto-completion section (dbaas-id ? username). - dbaas.grant.md: add Shell Auto-completion section (dbaas-id ? database-name ? grant-id). Storage resources (from #241): - backup.md: mark volume-id argument as supporting auto-completion. - restore.md: document create-command hierarchical completion (backup-id then volume-id), in addition to the existing get/list/delete section. getting-started.md: - Expand Storage section to cover backup create and restore create completion. - Add Database section showing sub-resource hierarchical completion examples. - Update closing note to mention create and list commands now also complete. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
aru-amedeo
pushed a commit
that referenced
this pull request
Jun 19, 2026
Covers all changes since v0.5.1: - feat: context auto-selection (#234) - feat: clear-contexts prompt on profile switch (#236) - fix: shell completion parent-ID slots for network sub-resources (#239/#240) - fix: shell completion parent-ID slots for database/storage sub-resources (#241) - fix: zone value in docs examples (#238) - docs: English and Italian completion section updates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 tasks
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.
Summary
Extends the parent-slot completion fix from #240 to the database and storage families.
database dbaas database:completeDBaaSDatabaseIDreturned nil forargs[0](dbaas-id slot) ? now delegates tocompleteDBaaSID. Registered oncreateandlist, which had noValidArgsFunction.database dbaas user: same fix ?completeDBaaSUserIDnow delegates atargs[0]. Registered oncreateandlist.database dbaas grant:completeGrantIDsuppressed all completions belowargs[2]? now chains DBaaS ? Database ? Grant IDs per slot. Registered on all four grant commands (create,list,get,delete), none of which had anyValidArgsFunction.storage backup create:storageBackupCmd(the create command) takes[volume-id]asargs[0]but had no completion; registeredcompleteBlockStorageID.storage restore create: newcompleteStorageRestoreCreateArgs? completes backup IDs atargs[0], block storage (volume) IDs atargs[1]. Registered onstorageRestoreCmd.Security family: no changes ?
keyandkmipresolve their KMS parent via--kms-idflag (already read incompleteKeyID/completeKmipID), and allcreate/listcommands in that family take no positional args.Slot completion after this fix
args[0]database dbaas database list <TAB>args[1]database dbaas database get <dbaas-id> <TAB>args[0]database dbaas user list <TAB>args[1]database dbaas user get <dbaas-id> <TAB>args[0]database dbaas grant list <TAB>args[1]database dbaas grant list <dbaas-id> <TAB>args[2]database dbaas grant get <dbaas-id> <db> <TAB>args[0]storage backup <TAB>args[0]storage restore <TAB>args[1]storage restore <backup-id> <TAB>Test plan
acloud database dbaas database list <TAB>? DBaaS IDs (was: nothing)acloud database dbaas database get <dbaas-id> <TAB>? database names (was: nothing)acloud database dbaas user list <TAB>? DBaaS IDs (was: nothing)acloud database dbaas grant list <TAB>? DBaaS IDs (was: nothing)acloud database dbaas grant list <dbaas-id> <TAB>? database names (was: nothing)acloud database dbaas grant get <dbaas-id> <db> <TAB>? grant IDs (was: nothing, no registration)acloud storage backup <TAB>? volume IDs (was: filesystem)acloud storage restore <TAB>? backup IDs (was: filesystem)acloud storage restore <backup-id> <TAB>? volume IDs (was: nothing)dbaas get <TAB>? DBaaS IDs,storage restore get <backup-id> <TAB>? restore IDsmake test-skip-clientpasses?? Generated with Claude Code