Completion using <files> or <directories> keywords #92
Replies: 4 comments 3 replies
|
When you are using or , the handling of these completions go to the bash completion library. I don't think we have control over it. In any case - you can always examine the output script that compleely generates, and see if there is a simple way to solve it there. |
|
Hi, looking into other completion files maybe I have found a simple solution for my suggestion: I changed 'localdir'*)
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_eisman_completions_filter "--help --flush-only")" -- "$cur")
;;into 'localdir'*)
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_eisman_completions_filter "--help --flush-only")" -- "$cur")
compopt -o filenames
;;and 'run'*)
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_eisman_completions_filter "--help")" -- "$cur")
;;
into 'run'*)
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_eisman_completions_filter "--help")" -- "$cur")
compopt -o filenames
;;
in the generated completion script. It is intented to use "compopt -o filenames" in both cases. What do you say about this? Marcus |
|
Hi, I'm now using completely_options:
complete_options: -o filenamesat top of yaml file because I established that this will not have an negative effect on all other competion definitions. Furthermore I made tests adding "compopt -o nospace" definitions in the generated script in some of the case switch branches and I never saw an influence to branches where this was not declared. I was not succesful on "--option=value" declaration in the yaml file; f. e. I tried - --option=
- <file>(without any additional setting by compopt) but never got any suggestion by typing TAB. Without "=" the declaration - --option
- <file>works as expected. Marcus |
|
For global complete options this is helpful, maybe it is possible to add "local" complete options which are set in to a single case switch branches. Maybe the yaml file could do it in that or a simular way: - +--option: (compopt -o somevalue)
- --value1
- value2
- ...Where the generated script can write this like: 'option'*)
while read ...
compopt -o somevalue
;;I do not see a difference in behaviour of the completion script wether the compopt line is layed down before or after the while line. Just an idea. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I use f. e.
- +--filepath: - <directory>or
for suggestion of files or directories.
Now I call the script
fbtr64toolbox.sh writesoapfile /[TAB]
which suggest all directories in root dir. When I now type a "v"[TAB] the result is
fbtr64toolbox.sh writesoapfile /var[space]
so that i have to use backspace and adding an / to continue the completion in the var sub dir.
Doing this complitation f. e. in grep the /v[TAB] completes to
grep /var/
where i can continue directly diving deeper in the directory structure.
Have I something to correct in my yaml file?
Marcus
All reactions