diff --git a/archmgr.py b/archmgr.py index 4e7b3de..43a821c 100644 --- a/archmgr.py +++ b/archmgr.py @@ -6,33 +6,40 @@ import commands.init as init import commands.pull as pull import commands.push as push -args, ap = cliargs.add_cli_args() -if args.cmd == None: - ap.print_help() - print("\nSpecify a subcommand, '-h' or '-v'") - exit(64) +if __name__ == "__main__": + args, ap = cliargs.add_cli_args() -print( - """ - _ - ( ) - _ _ _ __ ___| |__ ___ ___ __ _ __ - / _ ) __)/ ___) _ \\ _ _ \\/ _ \\ __) -( (_| | | ( (___| | | | ( ) ( ) | (_) | | - \\__ _)_) \\____)_) (_)_) (_) (_)\\__ |_) - ( )_) | - \\___/ - """ -) + if args.cmd == None: + ap.print_help() + print("\nSpecify a subcommand, '-h' or '-v'") + exit(64) -if args.cmd == "commit": - commit.commit(args.dry_run, args.force, args.no_commit) -elif args.cmd == "config": - config.config() -elif args.cmd == "init": - init.init(args.force) -elif args.cmd == "pull": - pull.pull(args.rebase, args.apply) -elif args.cmd == "push": - push.push(args.force) + print( + """ + _ + ( ) + _ _ _ __ ___| |__ ___ ___ __ _ __ + / _ ) __)/ ___) _ \\ _ _ \\/ _ \\ __) + ( (_| | | ( (___| | | | ( ) ( ) | (_) | | + \\__ _)_) \\____)_) (_)_) (_) (_)\\__ |_) + ( )_) | + \\___/ + """ + ) + + try: + if args.cmd == "commit": + commit.commit(args.dry_run, args.force, args.no_render) + elif args.cmd == "config": + config.config() + elif args.cmd == "init": + init.init(args.force) + elif args.cmd == "pull": + pull.pull(args.rebase, args.apply) + elif args.cmd == "push": + push.push(args.force) + except KeyboardInterrupt as e: + exit(130) + except Exception as e: + raise e diff --git a/commands/commit.py b/commands/commit.py index 659325f..fea724b 100644 --- a/commands/commit.py +++ b/commands/commit.py @@ -1,8 +1,11 @@ -from commands.util.choice import confirm_overwrite +from commands.util import pacman +from commands.util.input_mgr import confirm_overwrite, password -def commit(dry_run: bool = False, force: bool = False): +def commit(dry_run: bool = False, force: bool = False, no_render: bool = False): if dry_run: pass print("Commit, force:", force) + password() + print(pacman.list_explicitly_installed()) print(confirm_overwrite()) diff --git a/commands/util/diff.py b/commands/util/diff.py deleted file mode 100644 index 6bfaee2..0000000 --- a/commands/util/diff.py +++ /dev/null @@ -1,13 +0,0 @@ -from typing import List - - -def compute_diff(paths: List[str]): - pass - - -def file_diff(path: str): - pass - - -def pkg_diff(): - pass