Skip to content

Conversation

azzazzel
Copy link

@azzazzel azzazzel commented Sep 10, 2025

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:

  • Command signature updates: Changed from pc index create --name my-index to pc index create my-index
  • Argument validation: Added ValidateIndexNameArgs utility function to ensure exactly one non-empty index name is provided
  • Updated examples: All command examples and help text now use the new positional argument syntax
  • Unit testing: Added unit tests for all modified commands to ensure proper validation and functionality
  • Test utilities: Introduced standardized testing utilities for command validation and assertions

The implementation maintains backward compatibility in terms of functionality while improving the user experience through more intuitive command syntax.

Type of Change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

  1. Unit Tests: Run the new test suite to verify argument validation and command functionality:

    go test ./internal/pkg/cli/command/index/...
  2. Integration Testing: Test each modified command with the new syntax:

    # Test create command
    pc index create test-index --dimension 1536 --metric cosine --cloud aws --region us-east-1
    
    # Test describe command  
    pc index describe test-index
    
    # Test delete command
    pc index delete test-index
    
    # Test configure command
    pc index configure test-index --replicas 3
  3. Validation Testing: Verify that the new validation properly handles edge cases:

    • No arguments provided (should show error)
    • Multiple arguments provided (should show error)
    • Empty string argument (should show error)
  4. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant