Skip to content

Commit

Permalink
improve --help output, notably '--version' possibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
teto committed Oct 21, 2023
1 parent da0b544 commit bf5504e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions nix_update/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def parse_args(args: list[str]) -> Options:
"--shell", action="store_true", help="provide a shell with the package"
)
parser.add_argument(
"--version", nargs="?", help="Version to update to", default="stable"
"--version", nargs="?", default=VersionPreference.STABLE,
help="Version to update to. Possible values are: " + ', '.join(VersionPreference),
)
parser.add_argument(
"--override-filename",
Expand All @@ -84,7 +85,7 @@ def parse_args(args: list[str]) -> Options:
"attribute",
default=default_attribute,
nargs="?" if default_attribute else None, # type: ignore
help="Attribute name within the file evaluated",
help='''Attribute name within the file evaluated (defaults to environment variable "UPDATE_NIX_ATTR_PATH")''',
)

a = parser.parse_args(args)
Expand Down Expand Up @@ -309,7 +310,7 @@ def main(args: list[str] = sys.argv[1:]) -> None:

if options.review:
if options.flake:
print("--review is unsupporetd with --flake")
print("--review is unsupported with --flake")
else:
nixpkgs_review()

Expand Down
4 changes: 2 additions & 2 deletions nix_update/version/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from enum import Enum, auto
from enum import StrEnum, auto


@dataclass
Expand All @@ -9,7 +9,7 @@ class Version:
rev: str | None = None


class VersionPreference(Enum):
class VersionPreference(StrEnum):
STABLE = auto()
UNSTABLE = auto()
FIXED = auto()
Expand Down

0 comments on commit bf5504e

Please sign in to comment.