From f7348af1e0b8b2b98f45d72ae72146d11ac7b937 Mon Sep 17 00:00:00 2001 From: nik123 Date: Mon, 15 Jun 2020 00:39:33 +0700 Subject: [PATCH] metrics & plots: help output improvements (#3963) * metrics & plots: help output improvements * metrics & plots: ui: updated help messages * refactor: removed redundant parentheses * metrics: ui: updated 'targets' description in 'metrics show' * metrics: ui: reordered params to match the order in cmd ref * plots: ui: params modified to match cmd ref * plots: ui: updated diff help * Update dvc/command/plots.py Co-authored-by: Jorge Orpinel * Update dvc/command/plots.py Co-authored-by: Jorge Orpinel * Update dvc/command/plots.py Co-authored-by: Jorge Orpinel * Update dvc/command/plots.py Co-authored-by: Jorge Orpinel * Update dvc/command/plots.py Co-authored-by: Jorge Orpinel * Update dvc/command/plots.py Co-authored-by: Jorge Orpinel Co-authored-by: Ruslan Kuprieiev Co-authored-by: Jorge Orpinel --- dvc/command/metrics.py | 35 +++++++++++++++++++---------------- dvc/command/plots.py | 36 +++++++++++++++++++++++------------- 2 files changed, 42 insertions(+), 29 deletions(-) diff --git a/dvc/command/metrics.py b/dvc/command/metrics.py index c2db5dd28..8bca98a5e 100644 --- a/dvc/command/metrics.py +++ b/dvc/command/metrics.py @@ -165,7 +165,10 @@ def add_parser(subparsers, parent_parser): metrics_show_parser.add_argument( "targets", nargs="*", - help="Metric files or directories (see -R) to show", + help=( + "Limit command scope to these metric files. Using -R, " + "directories to search metric files in can also be given." + ), ) metrics_show_parser.add_argument( "-a", @@ -187,6 +190,12 @@ def add_parser(subparsers, parent_parser): default=False, help="Show metrics for all commits.", ) + metrics_show_parser.add_argument( + "--show-json", + action="store_true", + default=False, + help="Show output in JSON format.", + ) metrics_show_parser.add_argument( "-R", "--recursive", @@ -197,12 +206,6 @@ def add_parser(subparsers, parent_parser): "metric files." ), ) - metrics_show_parser.add_argument( - "--show-json", - action="store_true", - default=False, - help="Show output in JSON format.", - ) metrics_show_parser.set_defaults(func=CmdMetricsShow) METRICS_DIFF_HELP = ( @@ -222,14 +225,14 @@ def add_parser(subparsers, parent_parser): metrics_diff_parser.add_argument( "b_rev", nargs="?", - help=("New Git commit to compare (defaults to the current workspace)"), + help="New Git commit to compare (defaults to the current workspace)", ) metrics_diff_parser.add_argument( "--targets", nargs="*", help=( - "Metric files or directories (see -R) to show diff for. " - "Shows diff for all metric files by default." + "Limit command scope to these metric files. Using -R, " + "directories to search metric files in can also be given." ), metavar="", ) @@ -261,18 +264,18 @@ def add_parser(subparsers, parent_parser): default=False, help="Show tabulated output in the Markdown format (GFM).", ) - metrics_diff_parser.add_argument( - "--no-path", - action="store_true", - default=False, - help="Don't show metric path.", - ) metrics_diff_parser.add_argument( "--old", action="store_true", default=False, help="Show old metric value.", ) + metrics_diff_parser.add_argument( + "--no-path", + action="store_true", + default=False, + help="Don't show metric path.", + ) metrics_diff_parser.add_argument( "--precision", type=int, diff --git a/dvc/command/plots.py b/dvc/command/plots.py index 00d190269..c1d0b377e 100644 --- a/dvc/command/plots.py +++ b/dvc/command/plots.py @@ -98,8 +98,8 @@ class CmdPlotsModify(CmdPlots): def add_parser(subparsers, parent_parser): PLOTS_HELP = ( - "Generating plots for metrics stored in structured files " - "(JSON, CSV, TSV)." + "Commands to visualize and compare plot metrics in structured files " + "(JSON, YAML, CSV, TSV)" ) plots_parser = subparsers.add_parser( @@ -116,7 +116,7 @@ def add_parser(subparsers, parent_parser): fix_subparsers(plots_subparsers) - SHOW_HELP = "Generate a plots image file from a metrics file." + SHOW_HELP = "Generate plots from metric files." plots_show_parser = plots_subparsers.add_parser( "show", parents=[parent_parser], @@ -134,8 +134,8 @@ def add_parser(subparsers, parent_parser): plots_show_parser.set_defaults(func=CmdPlotsShow) PLOTS_DIFF_HELP = ( - "Plot differences in metrics between commits in the DVC " - "repository, or between the last commit and the workspace." + "Show multiple versions of plot metrics " + "by plotting them in a single image." ) plots_diff_parser = plots_subparsers.add_parser( "diff", @@ -148,6 +148,7 @@ def add_parser(subparsers, parent_parser): "--targets", nargs="*", help="Plots file to visualize. Shows all plots by default.", + metavar="", ) plots_diff_parser.add_argument( "revisions", nargs="*", default=None, help="Git commits to plot from", @@ -156,7 +157,7 @@ def add_parser(subparsers, parent_parser): _add_output_arguments(plots_diff_parser) plots_diff_parser.set_defaults(func=CmdPlotsDiff) - PLOTS_MODIFY_HELP = "Modify plot properties associated with a target file." + PLOTS_MODIFY_HELP = "Modify display properties of plot metric files." plots_modify_parser = plots_subparsers.add_parser( "modify", parents=[parent_parser], @@ -165,14 +166,14 @@ def add_parser(subparsers, parent_parser): formatter_class=argparse.RawDescriptionHelpFormatter, ) plots_modify_parser.add_argument( - "target", help="Plot file to set properties to.", + "target", help="Metric file to set properties to", ) _add_props_arguments(plots_modify_parser) plots_modify_parser.add_argument( "--unset", nargs="*", metavar="", - help="Properties to unset.", + help="Unset one or more display properties.", ) plots_modify_parser.set_defaults(func=CmdPlotsModify) @@ -189,9 +190,14 @@ def _add_props_arguments(parser): format_link("https://man.dvc.org/plots#plot-templates") ) ), + metavar="", + ) + parser.add_argument( + "-x", default=None, help="Field name for X axis.", metavar="" + ) + parser.add_argument( + "-y", default=None, help="Field name for Y axis.", metavar="" ) - parser.add_argument("-x", default=None, help="Field name for x axis.") - parser.add_argument("-y", default=None, help="Field name for y axis.") parser.add_argument( "--no-header", action="store_false", @@ -203,16 +209,20 @@ def _add_props_arguments(parser): "--title", default=None, metavar="", help="Plot title." ) parser.add_argument( - "--x-label", default=None, metavar="", help="X axis label." + "--x-label", default=None, help="X axis label", metavar="" ) parser.add_argument( - "--y-label", default=None, metavar="", help="Y axis lebel." + "--y-label", default=None, help="Y axis label", metavar="" ) def _add_output_arguments(parser): parser.add_argument( - "-o", "--out", default=None, help="Destination path to save plots to.", + "-o", + "--out", + default=None, + help="Destination path to save plots to", + metavar="", ) parser.add_argument( "--show-vega",