bash-completion.sh
branchv_0
changeset 45 f466b4c7d9b1
parent 31 c64e1588f428
child 52 fea625f0a096
equal deleted inserted replaced
44:dc5c210295d0 45:f466b4c7d9b1
    10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 # GNU General Public License for more details.
    11 # GNU General Public License for more details.
    12 #
    12 #
    13 # You should have received a copy of the GNU General Public License
    13 # You should have received a copy of the GNU General Public License
    14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
    14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
    15 
       
    16 _relpipe_in_filesystem_scripts() {
       
    17 	while read c; do echo ${c:31}; done < <(compgen -c "__relpipe_in_filesystem_script_");
       
    18 }
       
    19 
    15 
    20 _relpipe_in_filesystem_completion() {
    16 _relpipe_in_filesystem_completion() {
    21 	local w0 w1 w2
    17 	local w0 w1 w2
    22 
    18 
    23 	COMPREPLY=()
    19 	COMPREPLY=()
    58 	elif [[ "$w1" == "--as"            && "x$w0" == "x" ]];    then COMPREPLY=("''")
    54 	elif [[ "$w1" == "--as"            && "x$w0" == "x" ]];    then COMPREPLY=("''")
    59 	elif [[ "$w1" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    55 	elif [[ "$w1" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    60 	elif [[ "$w2" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    56 	elif [[ "$w2" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    61 	elif [[ "$w1" == "--file"                           ]];    then COMPREPLY=($(compgen -W "${FILE_FIELDS[*]}"  -- "$w0"))
    57 	elif [[ "$w1" == "--file"                           ]];    then COMPREPLY=($(compgen -W "${FILE_FIELDS[*]}"  -- "$w0"))
    62 	elif [[ "$w1" == "--xattr"                          ]];    then COMPREPLY=($(compgen -W "${XATTR_FIELDS[*]}" -- "$w0"))
    58 	elif [[ "$w1" == "--xattr"                          ]];    then COMPREPLY=($(compgen -W "${XATTR_FIELDS[*]}" -- "$w0"))
    63 	elif [[ "$w1" == "--streamlet"                      ]];    then COMPREPLY=($(compgen -W "$(_relpipe_in_filesystem_scripts)" -- "$w0"))
    59 	elif [[ "$w1" == "--streamlet"                      ]];    then COMPREPLY=($(while read c; do PATH="$RELPIPE_IN_FILESYSTEM_STREAMLET_PATH" type -P "$c" &>/dev/null && echo "$c"; done < <(PATH="$RELPIPE_IN_FILESYSTEM_STREAMLET_PATH" compgen -A command -- "$w0")))
    64 	else
    60 	else
    65 		OPTIONS=(
    61 		OPTIONS=(
    66 			"--relation"
    62 			"--relation"
    67 			"--file"
    63 			"--file"
    68 			"--xattr"
    64 			"--xattr"