On 7/28/23 2:52 PM, Grisha Levit wrote:
The output of `compopt' in a running completion function is a command where
the last word is usually the command for which the compspec was defined.

However, if the current compspec was found by using the basename of the
command word, or by invoking default completion, the output will use the
typed command word, rather than a command for which a compspec has been
defined.

$ f() { echo; compopt; }
$ complete -r
$ complete -F f f

$ f ^I
compopt +o [...] f

$ /bin/f ^I
compopt +o [...] /bin/f

In fact, the word printed at the end is the same string that is passed to
the completion function as $1.  I think it would be useful if the compopt
output instead used the actual command for the currently running compspec.
For example, this would allow a completion function to retrieve its
compspec by running `complete -p' with the last word of the `compopt'
output.

Thanks, this seems like a useful change.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/


Reply via email to