feat(cli): Better organized CLI arg parsing
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import argparse as ap
|
||||
|
||||
|
||||
def add_parser(sp: ap._SubParsersAction[ap.ArgumentParser]):
|
||||
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"
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
import argparse as ap
|
||||
|
||||
|
||||
def add_parser(sp: ap._SubParsersAction[ap.ArgumentParser]):
|
||||
config = sp.add_parser(
|
||||
"config", help="prints information about your config and change some of them"
|
||||
)
|
||||
conf_sp = config.add_subparsers(title="config options", dest="conf", required=True)
|
||||
conf_sp.add_parser("show", help="show config options")
|
||||
config_update = conf_sp.add_parser(
|
||||
"update", help="update the configuration from various"
|
||||
)
|
||||
conf_update_sp = config_update.add_subparsers(
|
||||
title="Options for automatic configuration updates",
|
||||
dest="conf_update",
|
||||
required=True,
|
||||
)
|
||||
conf_update_sp.add_parser(
|
||||
"pkgs",
|
||||
help="Update the config to reflect the package state of the current system",
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
import argparse as ap
|
||||
|
||||
|
||||
def add_parser(sp: ap._SubParsersAction[ap.ArgumentParser]):
|
||||
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",
|
||||
)
|
||||
@@ -0,0 +1,12 @@
|
||||
import argparse as ap
|
||||
|
||||
|
||||
def add_parser(sp: ap._SubParsersAction[ap.ArgumentParser]):
|
||||
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",
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
import argparse as ap
|
||||
|
||||
|
||||
def add_parser(sp: ap._SubParsersAction[ap.ArgumentParser]):
|
||||
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",
|
||||
)
|
||||
@@ -0,0 +1,12 @@
|
||||
import argparse as ap
|
||||
|
||||
|
||||
def add_parser(sp: ap._SubParsersAction[ap.ArgumentParser]):
|
||||
show = sp.add_parser("show", help="get information about configuration presets")
|
||||
show_sp = show.add_subparsers(
|
||||
title="config presets to show details on",
|
||||
dest="show",
|
||||
required=True,
|
||||
)
|
||||
pkgs = show_sp.add_parser("pkgs", help="show details on package presets")
|
||||
pkgs.add_argument("show_pkg")
|
||||
Reference in New Issue
Block a user