Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Features #16

Closed
3 tasks
JaikrishnaTS opened this issue Apr 5, 2018 · 10 comments
Closed
3 tasks

Missing Features #16

JaikrishnaTS opened this issue Apr 5, 2018 · 10 comments

Comments

@JaikrishnaTS
Copy link
Contributor

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:

  • Positional arguments
    • Take arguments based on the position.
  • nargs functionality
    • Take constant or variable number of arguments that follow
    • Important for optional arguments
    • Does not make much sense for positional arguments
  • Repeated flags/options
    • Allow to repeat flags or optional arguments to specify more inputs
    • Support for multiple levels like -vvv
@akamensky
Copy link
Owner

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
Copy link
Contributor Author

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

@josegonzalez
Copy link
Contributor

@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
Copy link
Owner

@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
Copy link
Contributor

@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
Copy link
Owner

@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
Copy link
Contributor

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

@akamensky
Copy link
Owner

yes, it is, receiving address.

@josegonzalez
Copy link
Contributor

Done :)

@akamensky
Copy link
Owner

akamensky commented Aug 1, 2018

Split into:
#20
#21
#22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants