Neal H. Walfield via devel wrote:
> Some ordering is
> required for an argument that takes a value.  Consider:
> 
>   command --output file
> 
>   command file --output

That's not two separate parameters; it's the name and value of a single
parameter. The space between them is another quirk that makes command
lines harder to understand. "--output=file" is clearer. To someone
reading a shellscript it's not always obvious whether two words are a
name and a value that belong together, or a boolean option and an
unnamed parameter. It's sometimes necessary to look up whether a certain
option takes a value before a command can be understood.

> Also, I think subcommands should be ordered.  Consider:
> 
>   sq key generate ...
> 
>   sq generate key ...

Subcommands and sub-subcommands inherently make a command-line syntax
more complex – but should they be thought of as parameters to the
command, or are they rather ... the command?

> In your example you seem to suggest that subcommand-specific
> parameters should be allowed before the subcommand.  I could imagine
> doing that, but that seems idiosyncratic.

At least four subcommands share the --signer-file option, but it's
considered subcommand-specific. On the other hand, --password-file is
apparently a global option, even though not all subcommands have a use
for a passphrase. There might be some technical reason, but it's not
obvious to a user why one of those is allowed before the subcommand and
the other must be after.

> Also,
> Sequoia acts similarly to other tools in this regard, like git:
> 
>   $ git --pretty=oneline log
>   unknown option: --pretty=oneline
>   usage: git ... <command> [<args>]
> 
> And cvs:
> 
>   $ cvs -h log
>   cvs: invalid option -- 'h'
>   Usage: cvs [cvs-options] command [command-options-and-arguments]

There are lots of them, as I said. Git and CVS are worse than Sequoia
in that some options are only allowed before the subcommand, others are
only allowed after it, and some single-letter flags exist both as
global options and subcommand options, with different meanings. Do you
know the difference between "git log -P" and "git -P log" without
looking it up?

If I've understood correctly, Sequoia at least allows global options
after the subcommand, so I can always write the subcommand first and
ignore the distinction between global options and subcommand options.
But then I need to remember which programs allow that and which don't.

> Perhaps the output would be less confusing if sq identified that the
> argument is out of order and displayed a message suggesting that the
> user reorder the option.

Yes, if it can reliably tell that the command would be valid if
reordered – but if it can do that, then it would be friendlier to just
interpret the command that way and run it.

Björn Persson

Attachment: pgphYNFnb0qW0.pgp
Description: OpenPGP digital signatur

-- 
_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to