IAU-ADES / ADES-Master

ADES implementation based on a master XML file
26 stars 7 forks source link

add argument parsing using argparse for python executables #23

Closed stevenstetzler closed 11 months ago

stevenstetzler commented 1 year ago

@federicaspoto and @stevechesley

This adds argument parsing using Python's argparse module instead of using sys.argv.

The diff looks bad because my code editor trimmed trailing whitespace--sorry!

The relevant changes are here:

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/mpc80coltoxml.py#L1078-L1115

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/psvtoxml.py#L519-L549

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/readxmlpy.py#L87-L105

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/valades.py#L30-L48

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/valall.py#L34-L95

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/valgeneral.py#L32-L93

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/validate.py#L33-L74

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/valsubmit.py#L33-L95

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/xmltompc80col.py#L423-L464

https://github.com/IAU-ADES/ADES-Master/blob/e814173e9982330547b11fe23f5d2d6e31b6fd76/Python/bin/xmltopsv.py#L314-L329

federicaspoto commented 1 year ago

@stevenstetzler it looks good to me! But I would add the corresponding tests, so that people will know how to call it. Apologies if you have already done it, I must have missed it.
Edit: Sorry, I just saw this was next on your list. Please go ahead and feel free to merge it.

stevenstetzler commented 11 months ago

@federicaspoto @stevechesley I merged Federica's changes into this branch and then updated the tests. All tests are passing and it looks good to me, so I've gone ahead and merged this into the master branch.