feat: add positional arguments support to get commands#489
Merged
jonathannorris merged 3 commits intomainfrom Aug 14, 2025
Merged
feat: add positional arguments support to get commands#489jonathannorris merged 3 commits intomainfrom
jonathannorris merged 3 commits intomainfrom
Conversation
kaushalkapasi
approved these changes
Aug 14, 2025
ac5d7b6 to
2dd0759
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds positional argument support to get commands for variables, features, and environments, allowing users to specify keys as space-separated or comma-separated arguments instead of only using the --keys flag.
- Added a shared utility function
parseKeysFromArgsto handle argument parsing with proper precedence - Updated three get commands to support positional arguments while maintaining backward compatibility
- Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/utils/parseKeysFromArgs.ts |
New utility function for parsing keys from various argument formats |
src/utils/parseKeysFromArgs.test.ts |
Test coverage for the utility function |
src/commands/variables/get.ts |
Updated to support positional arguments and new examples |
src/commands/variables/get.test.ts |
Added test for positional argument functionality |
src/commands/features/get.ts |
Updated to support positional arguments and new examples |
src/commands/features/get.test.ts |
Added test for positional argument functionality |
src/commands/environments/get.ts |
Updated to support positional arguments and new examples |
src/commands/environments/get.test.ts |
New test file with comprehensive test coverage |
oclif.manifest.json |
Updated manifest with new command configurations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| if (args.keys) { | ||
| // Handle the first positional argument if provided |
There was a problem hiding this comment.
The comment is misleading. The code handles args.keys which is not necessarily the first positional argument, but rather a named argument. Consider updating the comment to accurately reflect what this code does.
Suggested change
| // Handle the first positional argument if provided | |
| // Handle the named argument 'keys' if provided |
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.
Add positional arguments support to get commands
Implements FDN-561 to allow positional arguments as shorthand for the
--keysflag in get commands.What's Changed
Added support for positional arguments in:
dvc variables getdvc features getdvc environments getNew Usage Patterns
Key Features
✅ Backward compatible - existing
--keysflag usage unchanged✅ Precedence handling - positional args take priority over
--keys✅ Flexible input - supports both space and comma separation
✅ Updated help - new examples in command documentation
✅ DRY implementation - shared utility function for consistency
Testing