Potentially useful code snippets
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
643 B

import argparse,os
arguments=argparse.ArgumentParser(description="GeoBC unzipper/sorter/renamer")
arguments.add_argument("required", help="Required elements", nargs="*") #nargs=number of arguments
arguments.add_argument("-o", help="Optional elements")
arguments.add_argument("--alternate", help="This is supposedly a flag", action="store_true")
arguments.add_argument("-f", "--file", help="Which files to process instead")
#Don't forget to pass the arguments into another variable
test=arguments.parse_args()
print(test.required)
if test.o:
print(test.o)
if test.alternate:
print(test.alternate)
if test.file:
print(test.file)