akamensky / argparse

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

Missing Features #16

Closed JaikrishnaTS closed 6 years ago

JaikrishnaTS commented 6 years ago

While I'm not entirely convinced that all features of argparse are useful, a few are really nifty.

Making a list of few features that I think could be added:

akamensky commented 6 years ago

Hi Jaikrishna,

First, thank you for contributing to this project. Those features might be a good addition, but some of them would be harder to add due to great differences between Go and Python (i.e. strict type checking).

While it is true that this project is inspired by Python's argparse, it is not a clone of it, and I think one should consider whether features make sense in the scope of application or not.

For example -- positional arguments, while this feature sounds nice, it is not a hard requirement to have it as the argument is not necessarily have to be in certain position (moreover I have so much personal pain with some Linux tools that have all arguments as positional, and where one needs to remember precise order of arguments else bad things may happen; I am looking at lvm2 for example).

So my advice would be to consider whether those features worth implementing or not.

On the other hand if you feel that there is a great need for those -- feel free to send a PR. If you do however, I urge you to remember a couple of rules for the code to be accepted: 1 - no breaking changes (meaning current functionality should be kept as-is) and 2 - no external dependencies as well as no bloated code as the package should have minimal footprint in resulting application.

JaikrishnaTS commented 6 years ago

Hey Alexy, I believe I completely agree with your points. I will give this a run after I have a look at #2

josegonzalez commented 6 years ago

@akamensky I have a single use case for a positional argument.

I am building a tool that will allow me to process the Procfile format and spit out some information about them. One command I want to add is show, which will "show" the command for a given process type. This is the usage:

# shows the web process for the implicit "Procfile" file
procfile-util show web

# same thing, but for another path
procfile-util show web --procfile Procfile.test

This command would be incorrectly called if a process type is not specified. Thats not something I can currently (easily?) do with this library, though is simple with python's argparse.

Just wanted to note the use case here if it happens to sway any opinions. Thanks for the library, its working great otherwise :)

akamensky commented 6 years ago

@josegonzalez i agree that positional arguments have their use cases. However I am currently rather preoccupied with a large project and have no time to look at this.

josegonzalez commented 6 years ago

@akamensky no worries! Just wanted to add another point. This project has already done the thing I needed it for :)

Aside, any chance I can send you some beer money or similar in appreciation?

akamensky commented 6 years ago

@josegonzalez I am not doing this for donations, and made this package because I needed it myself for my project. But if you are eager to send some beer money you could drop some to here perhaps: 1Moxtc8AuTrxmDjSmbwtua4NSXfzyzoy7Y :D

josegonzalez commented 6 years ago

Is that a bitcoin thing? Happy to send if so.

akamensky commented 6 years ago

yes, it is, receiving address.

josegonzalez commented 6 years ago

Done :)

akamensky commented 6 years ago

Split into: https://github.com/akamensky/argparse/issues/20 https://github.com/akamensky/argparse/issues/21 https://github.com/akamensky/argparse/issues/22