Skip to content

Commit

Permalink
Fix command parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Feb 11, 2025
1 parent e438e77 commit e36b186
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions dev_cmd/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,7 @@ def _parse_commands(
f"{' '.join(data)}"
)

_command = Command(
name=name,
args=tuple(args),
extra_env=tuple(extra_env),
cwd=cwd,
accepts_extra_args=accepts_extra_args,
base=None,
hidden=hidden,
description=description,
)
for factors in required_steps[name]:
for factors in required_steps.get(name) or [()]:
factors_suffix = f"-{'-'.join(factors)}" if factors else ""

seen_factors: dict[Factor, FactorDescription] = {}
Expand Down Expand Up @@ -198,8 +188,16 @@ def substitute(text: str) -> str:

base: Command | None = None
if factors:
base = dataclasses.replace(
_command, factor_descriptions=tuple(seen_factors.values())
base = Command(
name=name,
args=tuple(args),
extra_env=tuple(extra_env),
cwd=cwd,
accepts_extra_args=accepts_extra_args,
base=None,
hidden=hidden,
description=description,
factor_descriptions=tuple(seen_factors.values()),
)

yield Command(
Expand All @@ -213,8 +211,6 @@ def substitute(text: str) -> str:
description=description,
factor_descriptions=tuple(seen_factors.values()),
)
else:
yield _command


def _parse_group(
Expand Down

0 comments on commit e36b186

Please sign in to comment.