refactor(config): split config command into subcommand packages
Split the monolithic config command into separate packages following the project's standard command structure.
Changes
- Each subcommand (get, set, edit) now in its own package
- Factory functions renamed to
NewCmdGet,NewCmdSet,NewCmdEditto match codebase patterns - Added options struct with
complete/validate/runmethods - Proper iostreams usage instead of direct cmd I/O
- Local
flvariable for multiple flags - Added test coverage for all subcommands including edit
- Tests use
t.Parallel()for concurrency
Structure
internal/commands/config/
├── config.go (parent command)
├── get/
│ ├── config_get.go
│ └── config_get_test.go
├── set/
│ ├── config_set.go
│ └── config_set_test.go
└── edit/
├── config_edit.go
└── config_edit_test.go
This refactoring brings the config command in line with the patterns used by other commands (alias, token, label) and follows all guidelines in .gitlab/duo/mr-review-instructions.yaml.
Test Results
All tests passing:
-
gitlab.com/gitlab-org/cli/internal/commands/config/get✅ -
gitlab.com/gitlab-org/cli/internal/commands/config/set✅ -
gitlab.com/gitlab-org/cli/internal/commands/config/edit✅