md-02 - Make index name argument (not flag) #35
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.
Problem
The current index commands (
create
,describe
,delete
,configure
) use the--name
flag to specify the index name, which is inconsistent with common CLI patterns where the primary identifier is typically provided as a positional argument. This makes the commands more verbose and less intuitive for users.Solution
This PR replaces the
--name
flag with positional arguments across all index commands, making the CLI more user-friendly and consistent with standard practices. The changes include:pc index create --name my-index
topc index create my-index
ValidateIndexNameArgs
utility function to ensure exactly one non-empty index name is providedThe implementation maintains backward compatibility in terms of functionality while improving the user experience through more intuitive command syntax.
Type of Change
Test Plan
Unit Tests: Run the new test suite to verify argument validation and command functionality:
go test ./internal/pkg/cli/command/index/...
Integration Testing: Test each modified command with the new syntax:
Validation Testing: Verify that the new validation properly handles edge cases:
Help Text Verification: Confirm that all help text and examples reflect the new positional argument syntax.
This PR follows up on the previous #34 md-01 PR and includes all the changes from that branch as well.