mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-11 06:34:13 +00:00
nixos-rebuild-ng: show help when manpage is disabled
This commit is contained in:
parent
da566994ea
commit
bd200697e9
@ -47,7 +47,9 @@ python3Packages.buildPythonApplication rec {
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace nixos_rebuild/__init__.py \
|
||||
--subst-var-by executable ${executable}
|
||||
--subst-var-by executable ${executable} \
|
||||
--subst-var-by withShellFiles ${lib.boolToString withShellFiles}
|
||||
|
||||
substituteInPlace pyproject.toml \
|
||||
--subst-var-by executable ${executable}
|
||||
'';
|
||||
|
@ -180,6 +180,14 @@ def parse_args(
|
||||
for group, parser in sub_parsers.items()
|
||||
}
|
||||
|
||||
if args.help or args.action is None:
|
||||
if "@withShellFiles@" == "true":
|
||||
r = run(["man", "8", "@executable@"], check=False)
|
||||
parser.exit(r.returncode)
|
||||
else:
|
||||
parser.print_help()
|
||||
parser.exit()
|
||||
|
||||
def parser_warn(msg: str) -> None:
|
||||
print(f"{parser.prog}: warning: {msg}", file=sys.stderr)
|
||||
|
||||
@ -194,10 +202,6 @@ def parse_args(
|
||||
if args.ask_sudo_password:
|
||||
args.sudo = True
|
||||
|
||||
if args.help or args.action is None:
|
||||
r = run(["man", "8", "@executable@"], check=False)
|
||||
parser.exit(r.returncode)
|
||||
|
||||
# TODO: use deprecated=True in Python >=3.13
|
||||
if args.install_grub:
|
||||
parser_warn("--install-grub deprecated, use --install-bootloader instead")
|
||||
|
Loading…
Reference in New Issue
Block a user