Create main.py
This commit is contained in:
32
src/main.py
Normal file
32
src/main.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
|
||||||
|
__VERSION__ = "1.0.0"
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
# parse cli args
|
||||||
|
arg_parser = argparse.ArgumentParser(
|
||||||
|
prog="neb",
|
||||||
|
description="Nebula, the package manager for the Comet programming language.",
|
||||||
|
epilog="Version " + __VERSION__
|
||||||
|
)
|
||||||
|
sub_parsers = arg_parser.add_subparsers(dest="cmd")
|
||||||
|
|
||||||
|
# install command
|
||||||
|
install_cmd = sub_parsers.add_parser(name="install", description="install a rock (package)")
|
||||||
|
install_cmd.add_argument("names", help="name of the rocks to install", nargs="+")
|
||||||
|
install_cmd.add_argument("--max-retries", help="max number of download retries before giving up", type=int, default=3)
|
||||||
|
|
||||||
|
args = arg_parser.parse_args()
|
||||||
|
|
||||||
|
if not args.cmd:
|
||||||
|
arg_parser.print_help()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# really feeling like a C programmer lmao
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
Reference in New Issue
Block a user