From 0d69d728999fccffa56760e36c910a0b5ffd08d0 Mon Sep 17 00:00:00 2001 From: a-kenji Date: Tue, 4 Feb 2025 15:56:57 +0700 Subject: [PATCH] pgks/cli: Add toplevel aliases --- pkgs/clan-cli/clan_cli/__init__.py | 6 ++++++ pkgs/clan-cli/docs.py | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/pkgs/clan-cli/clan_cli/__init__.py b/pkgs/clan-cli/clan_cli/__init__.py index d66a7860f..affd2c70c 100644 --- a/pkgs/clan-cli/clan_cli/__init__.py +++ b/pkgs/clan-cli/clan_cli/__init__.py @@ -148,6 +148,7 @@ Note: The meta results from clan/meta.json and manual flake arguments. parser_backups = subparsers.add_parser( "backups", + aliases=["b"], help="Manage backups of clan machines", description="Manage backups of clan machines", epilog=( @@ -175,6 +176,7 @@ For more detailed information visit: {help_hyperlink("backups", "https://docs.cl parser_flake = subparsers.add_parser( "flakes", + aliases=["f"], help="Create a clan flake inside the current directory", description="Create a clan flake inside the current directory", epilog=( @@ -300,6 +302,7 @@ For more detailed information, visit: {help_hyperlink("secrets", "https://docs.c # like facts but with vars instead of facts parser_vars = subparsers.add_parser( "vars", + aliases=["va"], help="Manage vars", description="Manage vars", epilog=( @@ -336,6 +339,7 @@ For more detailed information, visit: {help_hyperlink("secrets", "https://docs.c parser_machine = subparsers.add_parser( "machines", + aliases=["m"], help="Manage machines and their configuration", description="Manage machines and their configuration", epilog=( @@ -376,6 +380,7 @@ For more detailed information, visit: {help_hyperlink("deploy", "https://docs.cl parser_select = subparsers.add_parser( "select", + aliases=["se"], help="Select nixos values from the flake", description="Select nixos values from the flake", epilog=( @@ -400,6 +405,7 @@ Examples: parser_state = subparsers.add_parser( "state", + aliases=["st"], help="Query state information about machines", description="Query state information about machines", epilog=( diff --git a/pkgs/clan-cli/docs.py b/pkgs/clan-cli/docs.py index 71c7288cf..746fa9ed7 100644 --- a/pkgs/clan-cli/docs.py +++ b/pkgs/clan-cli/docs.py @@ -5,6 +5,8 @@ from pathlib import Path from clan_cli import create_parser +hidden_subcommands = ["machine", "b", "f", "m", "se", "st", "va"] + @dataclass class Option: @@ -259,6 +261,12 @@ def collect_commands() -> list[Category]: if str(subparser.description).startswith("WIP"): print(f"Excluded {name} from documentation as it is marked as WIP") 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( subparser, to=result, level=2, prefix=[name] )