%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/3163975/root/etc/bash_completion.d/
Upload File :
Create Path :
Current File : //proc/3163975/root/etc/bash_completion.d/veeam

#
# BASH completion script
# (c) Veeam Software Group GmbH
#

_veeamconfig()
{
	#
	# See history in folder (bash_completion.d).
	#

    IFS=$'\n'
    COMPREPLY=()
    lastArg="${COMP_WORDS[*]: -1}"

    #echo "command=[${COMP_WORDS[@]}]"
    
    # Call veeamconfig in Bash-completion mode and store result in 'completedArgs'
    completedArgs="$(VEEAM_BASH_COMPLETION=yes ${COMP_WORDS[@]} 2>&1)"
    completedArgs_result=$?
    
    #echo "completedArgs=[${completedArgs}]"
    #echo "completedArgs_result=[${completedArgs_result}]"

    # If argument completing was failed, exit
    if [[ ${completedArgs_result} -gt 0 ]]; then
        #echo "err"
        return 0
    fi

    # Prepare to return completed arguments as result in Bash
    IFS=$'\n' COMPREPLY=( $(echo "${completedArgs}") )
    #echo "orig COMPREPLY=[${COMPREPLY[@]}]"

    # Fix completed results if command is not ends on ' '.
    if [[ ! -z $lastArg && ${#COMPREPLY[*]} > 0 ]]; then
        lastArg_lc="`echo \"${lastArg}\" | sed -e 's/\(.*\)/\L\1/'`"
		lastArg_lc="`echo \"${lastArg_lc}\" | sed -e 's/\\\//g'`"

        complArg_lc="`echo \"${COMPREPLY[0]}\" | sed -e 's/\(.*\)/\L\1/'`"
		complArg_lc="`echo \"${complArg_lc}\" | sed -e 's/\\\//g'`"

        #echo "COMPREPLY[0]=[${COMPREPLY[0]}]"
		#echo "lastArg=[${lastArg}]"

        #echo "complArg_lc=[${complArg_lc}]"
		#echo "lastArg_lc=[${lastArg_lc}]"

        if [[ "${complArg_lc}" != "${lastArg_lc}"* ]]; then
            #echo "  reset COMPREPLY"
            COMPREPLY=("${lastArg}")
        fi
    fi

    #echo "final COMPREPLY=[${COMPREPLY[@]}]"
    return 0
}

complete -F _veeamconfig veeamconfig

Zerion Mini Shell 1.0