fish-shell / fish-shell Public
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
enhance function with argparse #5835
Comments
To be honest this just seems like a bit of a superfluous shortcut.
That's #3404 - argparse prints errors the same way all of our builtins do, and that was quite verbose. It's been shortened. With
and now you'll get
|
I'm not sure how it's superfluous anymore than parsing input arguments with -a NAMES is superfluous. Is C/C++ superfluous to ASM ? It's about being productive and ease of use. |
This is just rote text substitution, for a feature that, on the micro-scale, is barely used (you do argparse maybe once per function). At best, it is function foo --argparse a/alpha b/beta vs function foo
argparse -n foo a/alpha b/beta -- $argv With the added point that:
In essence, "there is only one way to do it" covers my main objection. As an alternative, there are a few things we could do to make argparse easier to use:
which would change the second example to: function foo
argparse a/alpha b/beta |
The difference here is once you starting using
I don't follow this comment. Just to clarify, my example is a function that would take several flags. Like you may
That's a good question.
it would be nice to add to the list that the original |
Which makes it longer than the argparse solution once you have two or three flags, simply by having to specify
I think it might be nicer to add positional argument support to argparse. So you'd do function foo
argparse a/alpha b/beta --positional input would add |
ah, it was just an initial suggestion. list is fine.
That's exactly what |
Not quite. E.g. if you call Whereas if you did |
you're right. I got confused. yeah, that would be good. |
Okay, one problem with that: If you forget the E.g. argparse h/help hello
# which should be
argparse h/help -- hello couldn't error |
This makes the `--name` option usually unnecessary. See #5835.
fish, version 3.0.2
Currently
function
takes option-a NAMES
(among) others to assign readable names to arguments.It would be nice if an
--flag
option was also available which makes use of the built-inargparse
command.Example usage:
Since function is already aware of the name of the function and what options are available for argparse, it should be able to output a nice help message as well (current argparse error is a bit much)
The text was updated successfully, but these errors were encountered: