CLI mostly set up
This commit is contained in:
70
cli/args.py
Normal file
70
cli/args.py
Normal file
@@ -0,0 +1,70 @@
|
||||
import argparse
|
||||
import argcomplete
|
||||
|
||||
|
||||
def add_cli_args():
|
||||
ap = argparse.ArgumentParser(
|
||||
"archmgr",
|
||||
description="A nixos-like declarative config and package manager for Arch Linux (or any other cdistro, with some tweaks)",
|
||||
usage="archmgr [command] [options]",
|
||||
)
|
||||
ap.add_argument("--version", "-v", action="version", version="%(prog)s V0.0.1")
|
||||
sp = ap.add_subparsers(
|
||||
title="commands",
|
||||
metavar="Use 'archmgr [command] --help' to see help for each command",
|
||||
dest="cmd",
|
||||
)
|
||||
|
||||
# ┌ ┐
|
||||
# │ Subcommands │
|
||||
# └ ┘
|
||||
commit = sp.add_parser(
|
||||
"commit", help="apply pending changes and commit to git repo"
|
||||
)
|
||||
commit.add_argument("--force", "-f", help="force apply", action="store_true")
|
||||
commit.add_argument(
|
||||
"--no-apply", "-n", help="do not apply to local system", action="store_true"
|
||||
)
|
||||
commit.add_argument(
|
||||
"--no-commit", "-N", help="do not commit changes to repo", action="store_true"
|
||||
)
|
||||
commit.add_argument(
|
||||
"--no-render", "-r", help="do not re-render renderables", action="store_true"
|
||||
)
|
||||
commit.add_argument(
|
||||
"--dry-run",
|
||||
"-d",
|
||||
help="print out files that would be changed",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
sp.add_parser("config", help="prints information about your config")
|
||||
|
||||
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",
|
||||
)
|
||||
|
||||
argcomplete.autocomplete(ap)
|
||||
|
||||
return ap.parse_args(), ap
|
||||
Reference in New Issue
Block a user