maradotwebp / pax

📦 The MC modpack manager for professionals.
https://github.com/froehlichA/pax/releases/latest
MIT License
161 stars 4 forks source link

Argument Parsing in Pax.nim becoming quite messy #60

Open langedev opened 2 years ago

langedev commented 2 years ago

Pax uses Therapist for its argument parsing. I don't have anything against Therapist, but I've found it quite difficult to solve the following problems with it.

My primary problem is how much repetition is in pax.nim. For instance any new command that you add must have common args added to it. If we wanted to add a new argument to every command we would have to edit every command. My thought to fix this was to create a template or proc which would automatically add these, but every command is a tuple in Therapist, and so I was unable to modify them after creation.

Similarly at the bottom of pax.nim is a list of conditionals checking for any given command, and any time a new command is added you have to add it to this bottom list as well.

This has really halted my progress on #42 and I'd love to fix this. If we are attached to the formatting of therapist I'm happy to provide an interface to communicate between some easier method of creating commands and using therapist. Otherwise I'm also happy to write something in Nim's provided parser. If there is no interest that is also fine, I'll just finish up #42 as I know there is interest in finishing it before 2.0

maradotwebp commented 2 years ago

Truth be told, I'm also not too happy about Therapist. I've been using cligen before, which I wasn't too happy with because generating custom help messages was a pain.

You could try taking a look at argparse, which out of all available options looks like it would be best for pax (judging from one glance).