From 0e845ea2c5cfef11fe6ef390908b4b42575a3a20 Mon Sep 17 00:00:00 2001 From: SpookyDervish Date: Sun, 18 Jan 2026 14:26:45 +1100 Subject: [PATCH] created command line parser --- requirements.txt | 1 + src/main.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 requirements.txt create mode 100644 src/main.py diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c94be38 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +rich \ No newline at end of file diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..41d9183 --- /dev/null +++ b/src/main.py @@ -0,0 +1,51 @@ +from rich import print +import argparse + + +def parse_arguments(): + # create our subcommands and args + arg_parser = argparse.ArgumentParser(prog="Digpkg", description="The package manager for the Ground programming language.") + sub_parsers = arg_parser.add_subparsers(dest="command") + + # install command + install_command = sub_parsers.add_parser(name="install", description="install a mineral") + install_command.add_argument("name", help="name of the mineral to install") + + # uninstall command + uninstall_command = sub_parsers.add_parser(name="uninstall", description="uninstall a mineral") + uninstall_command.add_argument("name", help="name of the mineral to uninstall") + + # list command + list_command = sub_parsers.add_parser(name="list", description="list all minerals installed in the current environment") + list_command.add_argument("--env_name", help="list all minerals from a specific environment.", default=None, required=False) + + # env command + env_command = sub_parsers.add_parser(name="env", description="manage Ground environments") + env_sub_parsers = env_command.add_subparsers(dest="env_command") + + env_new_command = env_sub_parsers.add_parser(name="new", description="create a new environment") + env_new_command.add_argument("name", help="name of the new environment") + env_new_command.add_argument("--dont-use", help="by default, the newly created environment will be set as the current environment. if this argument is parsed, then it will be created but not activated.", action="store_true") + + env_destroy_command = env_sub_parsers.add_parser(name="destroy", description="delete an environment") + env_destroy_command.add_argument("name", help="name of the environment to DESTROYYY") + env_destroy_command.add_argument("--confirm-yes", action="store_true", help="don't ask for confirmation (DANGEROUS)") + + env_list_command = env_sub_parsers.add_parser(name="list", description="list all environments") + + + args = arg_parser.parse_args() + + if not args.command: + arg_parser.print_help() + if args.command == "env" and not args.env_command: + env_command.print_help() + +def main(): + parse_arguments() + + + + +if __name__ == "__main__": + main() \ No newline at end of file