akamensky / argparse

Argparse for golang. Just because `flag` sucks
MIT License
604 stars 62 forks source link

Add support for positional arguments #20

Closed akamensky closed 2 years ago

akamensky commented 6 years ago

For some tools it makes more sense to use positional arguments instead of randomly located named arguments. The positional arguments must work as follows:

  1. Positional arguments can be placed only after named arguments and cannot mixed up with them
  2. Positional arguments order should be clearly defined in the code (possibly by order in which they are added)
  3. Positional argument parsing should account for shell expansions (namely wildcard in path arguments, which expands to multiple arguments)
jhughes1153 commented 4 years ago

@akamensky I could try to take a stab at this, the other branch seems to have stalled for this

akamensky commented 4 years ago

@jhughes1153 would be great if you can take a shot at this one. You can see #38 comments about one possible implementation. If you do work on it, I'd suggest perhaps first write how you would go about implementing this as to make sure everyone on the same page. Thanks a bunch!

jhughes1153 commented 4 years ago

38 seems like a reasonable approach, I think I should start with trying to get something along those lines to work and go from there

hellflame commented 3 years ago

Here I have to create another wheel for this, because the current project doesn't seem to have clear access to make upgrades (and the issue seem to h hang long enough). trust me I tried to upgrade the current project, but it easily become another brand new thing (modification across everywhere, take help function for example )

here is my version of approach https://github.com/hellflame/argparse

welcome to give any advice

by the way, my argparse also has solutions for

https://github.com/akamensky/argparse/issues/73 and https://github.com/akamensky/argparse/issues/70