galaxyproject / gxadmin

Handy command line utility for Galaxy administrators :rocket:
https://galaxyproject.github.io/gxadmin/#/
GNU General Public License v3.0
23 stars 27 forks source link

Update the wonderful argument parser #117

Closed hexylena closed 1 year ago

hexylena commented 1 year ago

Based on discussion in #113 to a newer specification. Now all of the following are supported:

<required>
<required|or|some|ignored|things> # Useful for <user|id|email> which is stored as arg_user
[optional]
[optional=default]
[--flag]  # Proper flag, boolean yes/undefined.
[--flag=] # No default but it's not a flag
[--flag=default] # Some default

This replaces the previous version of wap with some additional updates, notably these are now identical

--limit=123
--limit 123

@natefoo or @mira-miracoli would you be able to take this for a spin and check if nothing breaks that used to work?

hexylena commented 1 year ago

WAP also now has tests! So most of this should work, but, just want some real data.

hexylena commented 1 year ago
./gxadmin echoquery tool-metrics --ok --summary "Condense characters1" runtime_seconds 100

looks like it still didn't work

hexylena commented 1 year ago

precompiled if anyone wants to use it: gxadmin.txt

mira-miracoli commented 1 year ago

Thank you @hexylena ! I used your code and it worked well for me :tada:

hexylena commented 1 year ago

<required|or|some|ignored|things> What does "ignored things" refer to here?

In the case of <a|b|c>, only arg_a will be made available, not arg_b or arg_c, they serve purely as decoration/documentation for this parameter that can actually handle multiple datatypes.

In addition it looks like [--flag=] is a thing for documenting but not setting a default.

--flag               # nada, arg_flag=1 if provided.
--flag=description   # arg_flag=description, arg_flag=.. if passed on cli.
--flag=<description> # No default set, arg_flag=.. if passed on cli.

omg nroff heart_eyes

:yellow_heart: i'll try and remove the pandoc dependency next and yay. proper man pages.