fix: add create-command auto-completion for sub-resource parent IDs#251
Merged
Conversation
All `create` commands that take parent resource IDs as positional arguments now correctly complete only those parent IDs and stop — they no longer incorrectly offer the resource's own IDs on subsequent TAB presses. Changes per resource: Network: - subnet create: dedicated completeSubnetCreate; adds missing Args: ExactArgs(1) - securitygroup create: dedicated completeSecurityGroupCreate (vpc-id only) - securityrule create: dedicated completeSecurityRuleCreate (vpc-id → sg-id) - vpcpeering create: dedicated completeVPCPeeringCreate (vpc-id only) - vpcpeeringroute create: dedicated completeVPCPeeringRouteCreate (vpc-id → peering-id) - vpnroute create/list: new completeVPNRouteCreate + completeVPNTunnelID for list; fix completeVPNRouteID to complete tunnel-id on first TAB (was returning nil) Database: - dbaas database create: dedicated completeDBaasDatabaseCreate (dbaas-id only) - dbaas user create: dedicated completeDBaaSUserCreate (dbaas-id only) Docs: updated Shell Auto-completion sections for all affected resources to include the create (and list) commands. 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 #251 +/- ##
==========================================
+ Coverage 78.20% 78.27% +0.06%
==========================================
Files 53 53
Lines 12593 12633 +40
==========================================
+ Hits 9848 9888 +40
Misses 1575 1575
Partials 1170 1170
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:
|
Add tests for all new completion functions introduced in the previous commit, covering every code path: - completeSubnetCreate (delegates to VPC on arg 0, nil after) - completeSecurityGroupCreate (delegates to VPC on arg 0, nil after) - completeSecurityRuleCreate (VPC → SG → nil) - completeVPCPeeringCreate (delegates to VPC on arg 0, nil after) - completeVPCPeeringRouteCreate (VPC → peering → nil) - completeVPNRouteCreate (delegates to VPN tunnel on arg 0, nil after) - completeDBaasDatabaseCreate (delegates to DBaaS on arg 0, nil after) - completeDBaaSUserCreate (delegates to DBaaS on arg 0, nil after) - completeVPNRouteID: new arg-0 delegation to VPN tunnel + TooManyArgs guard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mmands Mirror the English completion-section changes across all Italian i18n files: subnet, securitygroup, securityrule, vpcpeering, vpcpeeringroute, vpnroute, dbaas.database, dbaas.user — adding create (and list for vpnroute) to the first-argument TAB examples and explaining that create stops after the parent resource IDs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
aru-amedeo
pushed a commit
that referenced
this pull request
Jun 22, 2026
First stable GA release. Covers the two fixes landed since v0.5.3: - #249/#251: securitygroup/securityrule doc examples corrected - #250/#251: create-command completion for nested resources, vpnroute completion gap, and subnet ExactArgs constraint Also adds the v0.5.3 comparison link which was previously missing from the footer, and updates [Unreleased] to point to v1.0.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
All
createcommands that take parent resource IDs as positional argumentsnow correctly complete only those parent IDs, then stop — they no longer
offer the resource's own IDs on subsequent TAB presses.
Additionally,
vpnrouteget/update/delete now complete the first argument(VPN tunnel ID) on TAB, which was previously broken (returning nothing).
Changes
cmd/ (code)
network.subnet.go: addcompleteSubnetCreate(vpc-id only); add missingArgs: cobra.ExactArgs(1)tosubnetCreateCmdnetwork.securitygroup.go: addcompleteSecurityGroupCreate(vpc-id only)network.securityrule.go: addcompleteSecurityRuleCreate(vpc-id → sg-id, then stop)network.vpcpeering.go: addcompleteVPCPeeringCreate(vpc-id only)network.vpcpeeringroute.go: addcompleteVPCPeeringRouteCreate(vpc-id → peering-id, then stop)network.vpnroute.go: fixcompleteVPNRouteIDto complete tunnel-id on first TAB; addcompleteVPNRouteCreate; wire create/list commandsdatabase.dbaas.database.go: addcompleteDBaasDatabaseCreate(dbaas-id only)database.dbaas.user.go: addcompleteDBaaSUserCreate(dbaas-id only)docs/
include the
create(andlist) commands, reflecting the new behavior.Test plan
acloud network subnet create <TAB>→ shows VPC IDsacloud network subnet create <vpc-id> <TAB>→ no suggestions (correct)acloud network securitygroup create <TAB>→ shows VPC IDsacloud network securitygroup create <vpc-id> <TAB>→ no suggestionsacloud network securityrule create <TAB>→ shows VPC IDsacloud network securityrule create <vpc-id> <TAB>→ shows SG IDsacloud network securityrule create <vpc-id> <sg-id> <TAB>→ no suggestionsacloud network vpnroute get <TAB>→ shows VPN tunnel IDs (was broken)acloud network vpnroute create <TAB>→ shows VPN tunnel IDs (was missing)acloud network vpnroute list <TAB>→ shows VPN tunnel IDs (was missing)acloud database dbaas database create <TAB>→ shows DBaaS IDsacloud database dbaas database create <dbaas-id> <TAB>→ no suggestionsacloud database dbaas user create <TAB>→ shows DBaaS IDsgo test ./cmd/...passesCloses #250
🤖 Generated with Claude Code