feat(cli): Better organized CLI arg parsing

This commit is contained in:
2026-05-14 17:36:06 +02:00
parent e24eb647ca
commit 78eecfc81a
13 changed files with 109 additions and 46 deletions
+8 -36
View File
@@ -1,6 +1,8 @@
import argparse
import argcomplete
from cli.commands import commit, config, init, pull, push, show
def add_cli_args():
ap = argparse.ArgumentParser(
@@ -18,43 +20,13 @@ def add_cli_args():
# ┌ ┐
# │ Subcommands │
# └ ┘
commit = sp.add_parser(
"commit", help="apply pending changes and commit to git repo"
)
commit.add_argument("-f", "--force", help="force apply (skips prompts)", action="store_true")
commit.add_argument(
"--no-render", "-r", help="do not re-render renderables", action="store_true"
)
# TODO: Allow changing things like config path
sp.add_parser("config", help="prints information about your config and change some of them")
sp.add_parser("setup", help="Do initial setup, like installing required tools")
init = sp.add_parser("init", help="initialize a new archmgr repository")
init.add_argument(
"--force",
"-f",
help="resets the git repository and initializes new archmgr repo",
action="store_true",
)
push = sp.add_parser("push", help="push pending changes to git remote")
push.add_argument(
"--force",
"-f",
help="force push (overriding possible remote changes)",
action="store_true",
)
pull = sp.add_parser("pull", help="pull changes from git remote")
pull.add_argument("--rebase", "-r", help="execute rebase", action="store_true")
pull.add_argument(
"--apply",
"-a",
help="also apply the changes to the local system",
action="store_true",
)
commit.add_parser(sp)
config.add_parser(sp)
init.add_parser(sp)
pull.add_parser(sp)
push.add_parser(sp)
show.add_parser(sp)
argcomplete.autocomplete(ap)