Devel §2 Completion - akinomyoga/ble.sh GitHub Wiki
[ 日本語 | English ] ≫ Manual [§1 Design widgets | §2 Completion
# Inside completion sources
ble/complete/cand/yield ACTION CAND DATA-
ACTIONspecifies the type of the candidates. The value should be one of the pre-defined / user-defined actions. -
CANDspecifies the generated candidate. -
DATAspecifies additional information on the candidate that will be used by the action. The interpretation depends on the action.
2.1.2 Bleopt complete_menu_style†
When this option is changed inside the completion sources, this takes an effect only for the current completion.
The meaning is the same as the global setting of complete_menu_style.
# Inside completion sources
# Switch to the "desc" view of the completion menu for the current completion
bleopt complete_menu_style=descThis section describes the APIs that can be used inside the progcomp functions specified by complete -F func COMMAND or defined as ble/cmdinfo/complete:COMMAND.
All the APIs for the completion sources can also be used by the progcomp functions since the progcomp functions are called inside source:argument.
2.2.1 Function compopt†
Inside the progcomp functions, the builtin command compopt is replaced with a function by ble.sh.
Here the options supported by the function compopt are explained.
# Inside progcomp functions
# set an option
compopt -o OPTION
# reset an option
compopt +o OPTIONOPTION is one of the following names. The option names starting with ble/ is an extension by ble.sh.
-
bashdefault(unused),default,dirnames,ble/default,ble/no-default(deprecated)These options control the behavior in the case that the progcomp does not generate any candidates. By default,
ble.shsetsble/defaultfor the completion option, which performs fallback completion. This behavior can be turned off by unsettingble/defaultbycompopt +o ble/default. Whenble/defaultis turned off, and when no candidates are generated, the directory name completion is first attempted ifdirnameis set. and then the filename completion is attempted if no directory names are generated. The Bashcompoptoptionbashdefaultis not referenced byble.sh. [ Note: In Bash,bashdefaultanddefaultspecify that the Bash/Readline completions should be appended when no candidates are generated. ]ble/no-defaultis a deprecated option name and the opposite ofble/default. -
plusdirsThis option specifies that the directory names should be generated in addition to the candidates generated by other
progcompspecifications. -
filenamesThis option specifies that the generated candidates should be adjusted as filenames.
- Colors and descriptions in
menu-completionis determined based on the file type. - In Bash, a slash
/is inserted when a unique completion is inserted if the candidate matches with a directory name. Inble.sh, the slash is inserted by default regardless of this option. Inble.sh, this option enables requoting the entire word to make the expanded result shorter: e.g.,a\ b\ c\ dmay be replaced by'a b c d'. - In Bash, the generated candidates will be properly quoted as filenames.
In
ble.sh, the candidates generated by progcomp are quoted regardless of this option, but the tilde at the beginning of the completion is not quoted when this option is specified and there is a matching filename.
- Colors and descriptions in
-
nospace,ble/no-mark-directoriesThe option
nospacespecifies that the space after the unique completion should not be inserted. The optionble/no-mark-directoriesspecifies that the slash after the unique completion should not be inserted. -
noquoteThis option specifies that the generated candidate should not be quoted by
ble.sh, but should be directly inserted in the command line. -
nosortThis option specifies that the order of the generated candidates should be kept.
-
ble/prog-trim(internal)This option specifies that the trailing spaces of the candidates generated by
compgen -C progshould be trimmed. -
ble/filter-by-prefixThis option specifies that the generated candidates should be filtered by the current word. The idea is similar to
COMPREPLY=($(compgen -W '"${COMPREPLY[@]}"' -- "$prefix"))whereprefixis the prefix of the current word before the cursor position. -
ble/syntax-rawThis option specifies that the completion is performed against the raw syntax words, so that the brance expansions and other constructs can be rewritten by the generated candidates. This option takes an effect only when
noquoteis also specified.
[ 日本語 | English ] ≫ Manual [§1 Design widgets | §2 Completion