Merge pull request 'pgks/cli: Add toplevel aliases' (#2820) from kenji/clan-core:feat/alias/toplevel into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/2820
This commit is contained in:
@@ -148,6 +148,7 @@ Note: The meta results from clan/meta.json and manual flake arguments.
|
|||||||
|
|
||||||
parser_backups = subparsers.add_parser(
|
parser_backups = subparsers.add_parser(
|
||||||
"backups",
|
"backups",
|
||||||
|
aliases=["b"],
|
||||||
help="Manage backups of clan machines",
|
help="Manage backups of clan machines",
|
||||||
description="Manage backups of clan machines",
|
description="Manage backups of clan machines",
|
||||||
epilog=(
|
epilog=(
|
||||||
@@ -175,6 +176,7 @@ For more detailed information visit: {help_hyperlink("backups", "https://docs.cl
|
|||||||
|
|
||||||
parser_flake = subparsers.add_parser(
|
parser_flake = subparsers.add_parser(
|
||||||
"flakes",
|
"flakes",
|
||||||
|
aliases=["f"],
|
||||||
help="Create a clan flake inside the current directory",
|
help="Create a clan flake inside the current directory",
|
||||||
description="Create a clan flake inside the current directory",
|
description="Create a clan flake inside the current directory",
|
||||||
epilog=(
|
epilog=(
|
||||||
@@ -300,6 +302,7 @@ For more detailed information, visit: {help_hyperlink("secrets", "https://docs.c
|
|||||||
# like facts but with vars instead of facts
|
# like facts but with vars instead of facts
|
||||||
parser_vars = subparsers.add_parser(
|
parser_vars = subparsers.add_parser(
|
||||||
"vars",
|
"vars",
|
||||||
|
aliases=["va"],
|
||||||
help="Manage vars",
|
help="Manage vars",
|
||||||
description="Manage vars",
|
description="Manage vars",
|
||||||
epilog=(
|
epilog=(
|
||||||
@@ -336,6 +339,7 @@ For more detailed information, visit: {help_hyperlink("secrets", "https://docs.c
|
|||||||
|
|
||||||
parser_machine = subparsers.add_parser(
|
parser_machine = subparsers.add_parser(
|
||||||
"machines",
|
"machines",
|
||||||
|
aliases=["m"],
|
||||||
help="Manage machines and their configuration",
|
help="Manage machines and their configuration",
|
||||||
description="Manage machines and their configuration",
|
description="Manage machines and their configuration",
|
||||||
epilog=(
|
epilog=(
|
||||||
@@ -376,6 +380,7 @@ For more detailed information, visit: {help_hyperlink("deploy", "https://docs.cl
|
|||||||
|
|
||||||
parser_select = subparsers.add_parser(
|
parser_select = subparsers.add_parser(
|
||||||
"select",
|
"select",
|
||||||
|
aliases=["se"],
|
||||||
help="Select nixos values from the flake",
|
help="Select nixos values from the flake",
|
||||||
description="Select nixos values from the flake",
|
description="Select nixos values from the flake",
|
||||||
epilog=(
|
epilog=(
|
||||||
@@ -400,6 +405,7 @@ Examples:
|
|||||||
|
|
||||||
parser_state = subparsers.add_parser(
|
parser_state = subparsers.add_parser(
|
||||||
"state",
|
"state",
|
||||||
|
aliases=["st"],
|
||||||
help="Query state information about machines",
|
help="Query state information about machines",
|
||||||
description="Query state information about machines",
|
description="Query state information about machines",
|
||||||
epilog=(
|
epilog=(
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ from pathlib import Path
|
|||||||
|
|
||||||
from clan_cli import create_parser
|
from clan_cli import create_parser
|
||||||
|
|
||||||
|
hidden_subcommands = ["machine", "b", "f", "m", "se", "st", "va"]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Option:
|
class Option:
|
||||||
@@ -259,6 +261,12 @@ def collect_commands() -> list[Category]:
|
|||||||
if str(subparser.description).startswith("WIP"):
|
if str(subparser.description).startswith("WIP"):
|
||||||
print(f"Excluded {name} from documentation as it is marked as WIP")
|
print(f"Excluded {name} from documentation as it is marked as WIP")
|
||||||
continue
|
continue
|
||||||
|
if str(name) in hidden_subcommands:
|
||||||
|
print(
|
||||||
|
f"Excluded {name} from documentation as it is a hidden subcommand."
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
|
||||||
(_options, _positionals, _subcommands) = get_subcommands(
|
(_options, _positionals, _subcommands) = get_subcommands(
|
||||||
subparser, to=result, level=2, prefix=[name]
|
subparser, to=result, level=2, prefix=[name]
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user