Closed in-in closed 5 years ago
This really only works if you completely omit the arguments, as in the pastel color teal | pastel format
example.
The help text also shows the USAGE section:
pastel format <type> [color]...
which implies that <type>
is a required argument if you want to specify the optional [color]...
arguments as well.
I think it is understandable that pastel format teal
does not work. I think it would also be a bad design if this would work, as there could be name clashes between the formatting type and color names.
Thanks for the explanation
If I understand correctly, then angle brackets <type>
mean - required and square brackets - [color]
optional
In the same time command pastel help sort-by
shows:
USAGE:
pastel sort-by [OPTIONS] [sort-order] [color]...
But this code doesn't work without the [sort-order]
argument
pastel sort-by teal plum
error: 'teal' isn't a valid value for '<sort-order>'
If I understand correctly, then angle brackets
<type>
mean - required and square brackets -[color]
optional
yes.
In the same time command
pastel help sort-by
shows:USAGE: pastel sort-by [OPTIONS] [sort-order] [color]...
That's unfortunate. I think I'll take your advise and change the help text for pastel format
to also show pastel format [type] [color]
, because type
is optional in some sense... it can be omitted because there is a default argument for it.
pastel sort-by teal plum error: 'teal' isn't a valid value for '<sort-order>'
Even if an argument is optional, you can never omit it if you want to specify arguments after them. I don't think this something that we do differently than most other command line programs. I can see how this takes some getting used to, but I don't really want pastel sort-by teal plum
to work, simply because pastel sort-by hue plum
is valid.
Actually, I think it's better to change sort-by
to show
pastel sort-by [OPTIONS] <sort-order> [color]...
That seems more natural to me. The sort order is required, but there is a default sort order.
Should be fixed in bc0ec98f1e32798f9eb0654956bab081cd6fdb74
For me, too. And again, thank you for your time and for explaining the concept of angle/ square brackets.
Help says (
pastel help format
) that thetype
parameter has a default value ofhex
. But if I run format subcommand and omit thetype
option, it causes an error:This command works without explicitly typing the
type
parameter