enhance function with argparse #5835
fish, version 3.0.2
It would be nice if an
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:
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
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
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
ah, it was just an initial suggestion. list is fine.
That's exactly what
E.g. if you call
Whereas if you did
Okay, one problem with that:
If you forget the
argparse h/help hello # which should be argparse h/help -- hello
This makes the `--name` option usually unnecessary. See #5835.