Skip to content

Commit

Permalink
Fix help output for commands and --color.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Feb 11, 2025
1 parent f98e9c9 commit e438e77
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 0.16.1

Fix missing help output for come commands and fix `--color` help.

## 0.16.0

Note when commands and tasks can accept extra args in `-l` / `--list` output.
Expand Down
2 changes: 1 addition & 1 deletion dev_cmd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 John Sirois.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

__version__ = "0.16.0"
__version__ = "0.16.1"
3 changes: 3 additions & 0 deletions dev_cmd/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class ColorChoice(Enum):
AUTO = "auto"
NEVER = "never"

def __str__(self) -> str:
return self.value


def set_color(choice: ColorChoice) -> None:
if choice is ColorChoice.NEVER:
Expand Down
24 changes: 14 additions & 10 deletions dev_cmd/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ 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]:
factors_suffix = f"-{'-'.join(factors)}" if factors else ""

Expand Down Expand Up @@ -188,16 +198,8 @@ def substitute(text: str) -> str:

base: Command | None = None
if factors:
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()),
base = dataclasses.replace(
_command, factor_descriptions=tuple(seen_factors.values())
)

yield Command(
Expand All @@ -211,6 +213,8 @@ 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 e438e77

Please sign in to comment.