coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add support for cksum --algorithm [sm3]


From: Bernhard Voelker
Subject: Re: Add support for cksum --algorithm [sm3]
Date: Thu, 9 Sep 2021 22:46:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.0.1

On 9/9/21 17:01, Pádraig Brady wrote:
> If one updated getopt/argmatch to support something like:
>
>    prog=$(cksum --?algo=md5 && echo 'cksum -a md5' || echo 'md5sum')
>
> That would be a bit more elegant, but less widely supported.
>
> Anyway all this is a general issue,
> that cksum shouldn't be considering in isolation I think.

E.g. to get the possible options for `find -D` (debug), one can run:

  $ find -D help
  Valid arguments for -D:
  exec       Show diagnostic information relating to -exec, -execdir, -ok and 
-okdir
  ...
  all        Set all of the debug flags (but help)
  help       Explain the various -D options

So 'help' being an argument which is treated specially.
Not too bad IMO, and easy to remember.

(The code for parsing options in find(1) is not generic at all due to
the nature of old minus-something style, but this is just to demonstrate
how it looks to the user.)

Anyway, the possibility to programmatically parse the supported options
is a totally new and different aspect.  I'm not sure I would try to go
that way for portable scripts.

Have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]