Skip to content

Commit

Permalink
exp init: ask for command before paths
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Nov 2, 2021
1 parent 915a755 commit 03b372a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions dvc/repo/experiments/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,14 @@ def init_interactive(
show_tree: bool = False,
live: bool = False,
) -> Dict[str, str]:
primary = lremove(
provided.keys(), ["cmd", "code", "data", "models", "params"]
)
command = provided.pop("cmd", None)
primary = lremove(provided.keys(), ["code", "data", "models", "params"])
secondary = lremove(
provided.keys(), ["live"] if live else ["metrics", "plots"]
)

ret: Dict[str, str] = {}

if not (primary or secondary):
if not (command or primary or secondary):
return ret

message = ui.rich_text.assemble(
Expand All @@ -170,6 +168,13 @@ def init_interactive(
)
ui.error_write(message, doc_link, "", sep="\n", styled=True)

if not command:
ret.update(_prompts(["cmd"], defaults))
ui.write()
else:
ret.update({"cmd": command})

ui.write("Enter the paths for dependencies and outputs of the command.")
if show_tree:
from rich.tree import Tree

Expand All @@ -178,7 +183,6 @@ def init_interactive(
highlight=True,
)
workspace = {**defaults, **provided}
workspace.pop("cmd", None)
if not live and "live" not in provided:
workspace.pop("live", None)
for value in sorted(workspace.values()):
Expand Down

0 comments on commit 03b372a

Please sign in to comment.