Monday, 15 July 2013

bash completion directory style partial suggestion printing -



bash completion directory style partial suggestion printing -

i working on script called to bookmarks file scheme locations in bash (with limited back upwards zsh). can find source here: https://github.com/resultsreturned/to

the script supports tab completion operations.

say have "bookmarked" location of folder:

mara@andromeda:~/bin/android-sdk-linux$ -b android

the script allows access subfolders of bookmark, so:

mara@andromeda:~$ android/docs/ mara@andromeda:~/bin/android-sdk-linux/docs$

pressing tab twice give suggestions:

mara@andromeda:~$ android/s<tab><tab> android/samples/ android/sd-card/ android/sources/ android/system-images/

however, rather suggestions print portion of path not input buffer. example, cd command:

mara@andromeda:~/bin$ cd android-sdk-linux/s<tab><tab> samples/ sd-card/ sources/ system-images/

note how suggestions contain directory level beingness input.

so question is, how command way bash prints suggestions? possible independently of completion wordlist (for compgen/complete)? there way define regex process completion wordlist printing suggestions?

since feature requests mark comment answer remain declined, re-create above solution here.

so solution turns out using -o filenames when invoking complete. showing substrings of compreply bash completion options user – resultsreturned

bash bash-completion

No comments:

Post a Comment