added help text and usage examples

This commit is contained in:
2023-10-27 11:37:51 +02:00
parent 9c20b41905
commit 6374b5abb7

View File

@ -62,14 +62,25 @@ def check_equal(val, ref):
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) example_text = """usage examples:
Dry run (nothing is changed or overwritten)
%(prog)s alvra p12345
parser.add_argument("instrument", choices=INSTRUMENTS) Create new files called scan_mod.json
parser.add_argument("pgroup", type=check_pgroup) %(prog)s alvra p12345 --no-dryrun
parser.add_argument("--no-dryrun", dest="dryrun", action="store_false") Overwrite scan.json
parser.add_argument("--inplace", action="store_true") %(prog)s alvra p12345 --no-dryrun --overwrite --inplace
parser.add_argument("--overwrite", action="store_true") """
parser = argparse.ArgumentParser(epilog=example_text, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("instrument", choices=INSTRUMENTS, help="Which instrument has the data been measured at?")
parser.add_argument("pgroup", type=check_pgroup, help="Which pgroup is the data in?")
parser.add_argument("--no-dryrun", dest="dryrun", action="store_false", help="Disable dry run. If dryrun is enabled (default) no files are written.")
parser.add_argument("--inplace", action="store_true", help="Update scan.json in place. If inplace is disabled (default) a new file scan_mod.json is created.")
parser.add_argument("--overwrite", action="store_true", help="Overwrite existing files. If overwrite is disabled (default) existing files will be skipped.")
clargs = parser.parse_args() clargs = parser.parse_args()
#print(clargs) #print(clargs)