#!/usr/bin/env python3 # PYTHON_ARGCOMPLETE_OK from typing import cast import cli.args as cliargs import commands.commit as commit import commands.config as config import commands.init as init import commands.pull as pull import commands.push as push import commands.prepare as setup import commands.show as show from config import load_config from presets import ArchMgrTemplates if __name__ == "__main__": args, ap = cliargs.add_cli_args() if args.cmd == None: ap.print_help() print("\nSpecify a subcommand, '-h' or '-v'") exit(64) print(""" _ ( ) _ _ _ __ ___| |__ ___ ___ __ _ __ / _ ) __)/ ___) _ \\ _ _ \\/ _ \\ __) ( (_| | | ( (___| | | | ( ) ( ) | (_) | | \\__ _)_) \\____)_) (_)_) (_) (_)\\__ |_) ( )_) | \\___/ """) conf = load_config("config.yml") try: if args.cmd == "commit": commit.commit(conf, args.force, args.no_render) elif args.cmd == "config": config.config(args, conf) elif args.cmd == "init": init.init(args.force) elif args.cmd == "setup": setup.setup() elif args.cmd == "pull": pull.pull(conf, args.rebase, args.apply) elif args.cmd == "push": push.push(args.force) elif args.cmd == "show": show.show(conf, cast(ArchMgrTemplates, {}), args) except KeyboardInterrupt as e: exit(130) except Exception as e: raise e