mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
committed by
Saugat Pachhai
parent
fd440df5b3
commit
02b2ab6804
@@ -9,7 +9,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class CmdExperimentsList(CmdBase):
|
||||
def run(self):
|
||||
names_only = self.args.names_only
|
||||
name_only = self.args.name_only
|
||||
exps = self.repo.experiments.ls(
|
||||
all_commits=self.args.all_commits,
|
||||
rev=self.args.rev,
|
||||
@@ -23,10 +23,10 @@ class CmdExperimentsList(CmdBase):
|
||||
if branch:
|
||||
tag = branch.split("/")[-1]
|
||||
name = tag if tag else baseline[:7]
|
||||
if not names_only:
|
||||
if not name_only:
|
||||
print(f"{name}:")
|
||||
for exp_name in exps[baseline]:
|
||||
indent = "" if names_only else "\t"
|
||||
indent = "" if name_only else "\t"
|
||||
print(f"{indent}{exp_name}")
|
||||
|
||||
return 0
|
||||
@@ -45,6 +45,7 @@ def add_parser(experiments_subparsers, parent_parser):
|
||||
)
|
||||
add_rev_selection_flags(experiments_list_parser, "List")
|
||||
experiments_list_parser.add_argument(
|
||||
"--name-only",
|
||||
"--names-only",
|
||||
action="store_true",
|
||||
help="Only output experiment names (without parent commits).",
|
||||
|
||||
@@ -94,9 +94,7 @@ class CmdStageList(CmdBase):
|
||||
self.repo.stage_collection_error_handler = log_error
|
||||
|
||||
stages = self._get_stages()
|
||||
names_only = self.args.names_only
|
||||
|
||||
data = prepare_stages_data(stages, description=not names_only)
|
||||
data = prepare_stages_data(stages, description=not self.args.name_only)
|
||||
ui.table(data.items())
|
||||
|
||||
return 0
|
||||
@@ -358,6 +356,7 @@ def add_parser(subparsers, parent_parser):
|
||||
help="List all stages inside the specified directory.",
|
||||
)
|
||||
stage_list_parser.add_argument(
|
||||
"--name-only",
|
||||
"--names-only",
|
||||
action="store_true",
|
||||
default=False,
|
||||
|
||||
@@ -31,11 +31,13 @@ def _id_gen(val) -> str:
|
||||
(["status", "--show-json"], "json"),
|
||||
(["plots", "show", "--show-json"], "json"),
|
||||
(["plots", "diff", "--show-json"], "json"),
|
||||
(["exp", "list", "--names-only"], "name_only"),
|
||||
(["stage", "list", "--names-only"], "name_only"),
|
||||
],
|
||||
ids=_id_gen,
|
||||
)
|
||||
def test_backward_compat_flags(args, key):
|
||||
"""Test support for --show-csv/--show-json/--show-md flags."""
|
||||
"""Test support for flags kept for backward compatibility."""
|
||||
cli_args = parse_args(args)
|
||||
d = vars(cli_args)
|
||||
assert d[key] is True
|
||||
|
||||
@@ -201,7 +201,7 @@ def test_experiments_list(dvc, scm, mocker):
|
||||
"-1",
|
||||
"--rev",
|
||||
"foo",
|
||||
"--names-only",
|
||||
"--name-only",
|
||||
]
|
||||
)
|
||||
assert cli_args.func == CmdExperimentsList
|
||||
|
||||
Reference in New Issue
Block a user