-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Specify cmd arg names (metavars), et al. #3626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ccb55cd
add: -f arg name from FILE to <filename>
jorgeorpinel 8e04fd9
Merge branch 'master' into dvc/command/metavar
jorgeorpinel 2632344
dvc: cmd arg names (metavars) to match docs
jorgeorpinel 5559ff6
metrics: update help output to indicate supported types
jorgeorpinel 91647ca
dvc: reorder subcommands to match docs
jorgeorpinel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -177,6 +177,40 @@ def add_parser(subparsers, parent_parser): | |
|
|
||
| fix_subparsers(metrics_subparsers) | ||
|
|
||
| METRICS_ADD_HELP = "Mark a DVC-tracked file as a metric." | ||
| metrics_add_parser = metrics_subparsers.add_parser( | ||
| "add", | ||
| parents=[parent_parser], | ||
| description=append_doc_link(METRICS_ADD_HELP, "metrics/add"), | ||
| help=METRICS_ADD_HELP, | ||
| formatter_class=argparse.RawDescriptionHelpFormatter, | ||
| ) | ||
| metrics_add_parser.add_argument( | ||
| "-t", "--type", help="Type of metrics (json/yaml).", metavar="<type>", | ||
| ) | ||
| metrics_add_parser.add_argument( | ||
| "-x", "--xpath", help="json/yaml path.", metavar="<path>", | ||
| ) | ||
| metrics_add_parser.add_argument("path", help="Path to a metric file.") | ||
| metrics_add_parser.set_defaults(func=CmdMetricsAdd) | ||
|
|
||
| METRICS_MODIFY_HELP = "Modify metric default formatting." | ||
| metrics_modify_parser = metrics_subparsers.add_parser( | ||
| "modify", | ||
| parents=[parent_parser], | ||
| description=append_doc_link(METRICS_MODIFY_HELP, "metrics/modify"), | ||
| help=METRICS_MODIFY_HELP, | ||
| formatter_class=argparse.RawDescriptionHelpFormatter, | ||
| ) | ||
| metrics_modify_parser.add_argument( | ||
| "-t", "--type", help="Type of metrics (json/yaml).", metavar="<type>", | ||
| ) | ||
| metrics_modify_parser.add_argument( | ||
| "-x", "--xpath", help="json/yaml path.", metavar="<path>", | ||
| ) | ||
| metrics_modify_parser.add_argument("path", help="Path to a metric file.") | ||
| metrics_modify_parser.set_defaults(func=CmdMetricsModify) | ||
|
|
||
| METRICS_SHOW_HELP = "Print metrics, with optional formatting." | ||
| metrics_show_parser = metrics_subparsers.add_parser( | ||
| "show", | ||
|
|
@@ -194,13 +228,14 @@ def add_parser(subparsers, parent_parser): | |
| "-t", | ||
| "--type", | ||
| help=( | ||
| "Type of metrics (json/tsv/htsv/csv/hcsv). " | ||
| "Type of metrics (json/yaml). " | ||
|
Comment on lines
-197
to
+231
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "It can be detected by the file extension automatically. " | ||
| "Unsupported types will be treated as raw." | ||
| ), | ||
| metavar="<type>", | ||
| ) | ||
| metrics_show_parser.add_argument( | ||
| "-x", "--xpath", help="json/tsv/htsv/csv/hcsv path." | ||
| "-x", "--xpath", help="json/yaml path.", metavar="<path>", | ||
| ) | ||
| metrics_show_parser.add_argument( | ||
| "-a", | ||
|
|
@@ -234,51 +269,6 @@ def add_parser(subparsers, parent_parser): | |
| ) | ||
| metrics_show_parser.set_defaults(func=CmdMetricsShow) | ||
|
|
||
| METRICS_ADD_HELP = "Mark a DVC-tracked file as a metric." | ||
| metrics_add_parser = metrics_subparsers.add_parser( | ||
| "add", | ||
| parents=[parent_parser], | ||
| description=append_doc_link(METRICS_ADD_HELP, "metrics/add"), | ||
| help=METRICS_ADD_HELP, | ||
| formatter_class=argparse.RawDescriptionHelpFormatter, | ||
| ) | ||
| metrics_add_parser.add_argument( | ||
| "-t", "--type", help="Type of metrics (raw/json/tsv/htsv/csv/hcsv)." | ||
| ) | ||
| metrics_add_parser.add_argument( | ||
| "-x", "--xpath", help="json/tsv/htsv/csv/hcsv path." | ||
| ) | ||
| metrics_add_parser.add_argument("path", help="Path to a metric file.") | ||
| metrics_add_parser.set_defaults(func=CmdMetricsAdd) | ||
|
|
||
| METRICS_MODIFY_HELP = "Modify metric default formatting." | ||
| metrics_modify_parser = metrics_subparsers.add_parser( | ||
| "modify", | ||
| parents=[parent_parser], | ||
| description=append_doc_link(METRICS_MODIFY_HELP, "metrics/modify"), | ||
| help=METRICS_MODIFY_HELP, | ||
| formatter_class=argparse.RawDescriptionHelpFormatter, | ||
| ) | ||
| metrics_modify_parser.add_argument( | ||
| "-t", "--type", help="Type of metrics (raw/json/tsv/htsv/csv/hcsv)." | ||
| ) | ||
| metrics_modify_parser.add_argument( | ||
| "-x", "--xpath", help="json/tsv/htsv/csv/hcsv path." | ||
| ) | ||
| metrics_modify_parser.add_argument("path", help="Path to a metric file.") | ||
| metrics_modify_parser.set_defaults(func=CmdMetricsModify) | ||
|
|
||
| METRICS_REMOVE_HELP = "Remove metric mark on a DVC-tracked file." | ||
| metrics_remove_parser = metrics_subparsers.add_parser( | ||
| "remove", | ||
| parents=[parent_parser], | ||
| description=append_doc_link(METRICS_REMOVE_HELP, "metrics/remove"), | ||
| help=METRICS_REMOVE_HELP, | ||
| formatter_class=argparse.RawDescriptionHelpFormatter, | ||
| ) | ||
| metrics_remove_parser.add_argument("path", help="Path to a metric file.") | ||
| metrics_remove_parser.set_defaults(func=CmdMetricsRemove) | ||
|
|
||
| METRICS_DIFF_HELP = "Show changes in metrics between commits" | ||
| " in the DVC repository, or between a commit and the workspace." | ||
| metrics_diff_parser = metrics_subparsers.add_parser( | ||
|
|
@@ -303,18 +293,20 @@ def add_parser(subparsers, parent_parser): | |
| "Metric files or directories (see -R) to show diff for. " | ||
| "Shows diff for all metric files by default." | ||
| ), | ||
| metavar="<paths>", | ||
| ) | ||
| metrics_diff_parser.add_argument( | ||
| "-t", | ||
| "--type", | ||
| help=( | ||
| "Type of metrics (json/tsv/htsv/csv/hcsv). " | ||
| "Type of metrics (json/yaml). " | ||
| "It can be detected by the file extension automatically. " | ||
| "Unsupported types will be treated as raw." | ||
| ), | ||
| metavar="<type>", | ||
| ) | ||
| metrics_diff_parser.add_argument( | ||
| "-x", "--xpath", help="json/tsv/htsv/csv/hcsv path." | ||
| "-x", "--xpath", help="json/yaml path.", metavar="<path>", | ||
| ) | ||
| metrics_diff_parser.add_argument( | ||
| "-R", | ||
|
|
@@ -333,3 +325,14 @@ def add_parser(subparsers, parent_parser): | |
| help="Show output in JSON format.", | ||
| ) | ||
| metrics_diff_parser.set_defaults(func=CmdMetricsDiff) | ||
|
|
||
| METRICS_REMOVE_HELP = "Remove metric mark on a DVC-tracked file." | ||
| metrics_remove_parser = metrics_subparsers.add_parser( | ||
| "remove", | ||
| parents=[parent_parser], | ||
| description=append_doc_link(METRICS_REMOVE_HELP, "metrics/remove"), | ||
| help=METRICS_REMOVE_HELP, | ||
| formatter_class=argparse.RawDescriptionHelpFormatter, | ||
| ) | ||
| metrics_remove_parser.add_argument("path", help="Path to a metric file.") | ||
| metrics_remove_parser.set_defaults(func=CmdMetricsRemove) | ||
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this is better than
-f FILE.<>look out of place here, and I don't really see the value, sorry.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But ok, if you want to, sure, lets do it this way. Please remove "Draft" flag from your PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, the value can be better seen here - https://dvc.org/doc/command-reference/run#run
check with what
dvc runoutputs.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruslan, 2 benefits (besides matching the docs which we already changed π ):
--outs OUTSwhy repeat the option name when the param name can hint to what kind of argument is accepted.<>e.g. https://git-scm.com/docs/git-commit