help-bash
[Top][All Lists]
Advanced

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

Re: compopt doesn't seem to output options for current completion specif


From: Chet Ramey
Subject: Re: compopt doesn't seem to output options for current completion specification as documented
Date: Tue, 13 Feb 2024 16:38:39 -0500
User-agent: Mozilla Thunderbird

On 2/12/24 4:29 PM, Britton Kerin wrote:
help compopt says:

      Modify the completion options for each NAME, or, if no NAMEs are supplied
      the completion currently being executed.  If no OPTIONs are given, print
      the completion options for each NAME or the current completion
specification.

But compopt seems to be entirely silent when run from a completion function:

      $ declare -f tcmd
      tcmd ()
      {
          echo running tcmd got args $@
      }
      $ declare -f tcmd_completer
      tcmd_completer ()
      {
          compopt -o noquote;
          compopt;
          COMPREPLY[0]='fooop"'
      }
      $ complete -F tcmd_completer tcmd
      $ compopt tcmd
      compopt +o bashdefault +o default +o dirnames +o filenames +o
noquote +o nosort +o nospace +o plusdirs tcmd
      $ tcmd fooop"
      bash: unexpected EOF while looking for matching `"'
      bash: syntax error: unexpected end of file

The noquote option is definitely being applied (as the error output of
the last command is intended to show) but compopt inside the
completion function is silent.  I've tried redirecting the compopt
output to a file in case it somehow doesn't make it to the terminal,
but that just results in an empty file.

I can't reproduce it (x16 has your function definitions and the complete
command):

$ echo $BASH_VERSION
5.2.26(2)-release
$ . ./x16
$ tcmd compopt +o bashdefault +o default +o dirnames +o filenames -o noquote +o nosort +o nospace +o plusdirs tcmd
fooop"


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




reply via email to

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