help-bash
[Top][All Lists]
Advanced

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

compopt doesn't seem to output options for current completion specificat


From: Britton Kerin
Subject: compopt doesn't seem to output options for current completion specification as documented
Date: Mon, 12 Feb 2024 12:29:19 -0900

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.

Am I missing something here or is compopt not behaving as it's help
says it does?

Britton



reply via email to

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