[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Request for long option support for find -type
From: |
Bernhard Voelker |
Subject: |
Re: Request for long option support for find -type |
Date: |
Sat, 30 Sep 2023 15:37:30 +0200 |
User-agent: |
Mozilla Thunderbird |
On 9/29/23 04:00, A C wrote:
I would like to request that the find command supports long options for the -type argument, such as
"--type=directory" or "-type directory". This would make the command more
readable and self-explanatory, especially when writing bash scripts that use find.
Thanks for the suggestion, but I'd like to understand ...
It would also be consistent with the other long options that find already
supports, such as -name, -size, --mtime, etc.
... where did you see --name, --size and --mtime in GNU find?
The only find options having double-dash long options are -help/--help and
-version/--version.
I understand that this might require some changes to the code and the
documentation, and I am not sure if there are any technical or historical
reasons why this feature is not implemented yet. However, I think it would be a
nice addition to the find command, and I hope you will consider it.
find(1) is a very old tool ... and probably one of the first UNIX tools.
The supported options are mandated by POSIX [1], and they're all single-dashed
options and operands. This is quite unique.
[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html
Changing only -type to allow also --type would be a possible extension which
is allowed by POSIX, but then why would then all the others stay with
single-minus?
Changing all from '-....' to '--....' would be possible, of course, but that
would
mean a lot of changes and probably lead to redundant code harder to maintain.
I'd question the gain of all this, and therefore am 10:90 for adding it.
FWIW the way find(1) parses its arguments is also special (or nowadays unusual):
it requires the starting points right before all the predicate expressions,
while most other tools allow
$ tool -a -b --long --option -- argument1 arg2
Have a nice day,
Berny