Showing only the substrings of COMPREPLY bash completion options to the user

前端 未结 2 1422
后悔当初
后悔当初 2020-12-17 04:12

In a bash completion script, suppose COMPREPLY=(aa/ba/ aa/bb/). When the script is invoked, the completion options looks like this to the user:

         


        
2条回答
  •  情歌与酒
    2020-12-17 05:01

    I was having the same problem and I fixed it by adjusting how I bound the completion function to the command. I know this works when you are dealing with actual files in the filesystem, I think it will work with any sort of file path like options, but I'm not sure.

    Before:

    complete -F _fubar fubar
    

    After:

    complete -o filenames -F _fubar fubar
    

    For more details: Programmable Completion Builtins

提交回复
热议问题