| Server IP : 101.53.144.229 / Your IP : 216.73.216.181 Web Server : Apache System : Linux host.gdigitalindia.in 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : digitalshiksha ( 1179) PHP Version : 5.6.40 Disable Function : eval,show_source,system,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,dl,show_source,curl_multi_exechellcmd, ini_restore,apache_get_modules,get_cfg_var,passthru, exec ,proc_get_status,fpassthru,c999_buff_prepare,c999_sess_put,c99_buff_prepare,c99_sess_put,proc_close,ini_alter,dl,symlink,link,proc_close,ini_alter,dl,symlink,link,mail MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /etc/bash_completion.d/ |
Upload File : |
# main function bound to scl command
_scl()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-l --list"
# handle options
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
local collections=($(find /etc/scl/prefixes -maxdepth 1 -mindepth 1 -type f -exec basename {} \; | sort -u))
# handle scriptlets; the first parameter must be a scriptlet if it is not an option
if ((COMP_CWORD == 1)); then
# get array of scriptlets found throughout collections
local scriptlets=()
for col in ${collections[@]}; do
local prefix=`cat /etc/scl/prefixes/$col`
scriptlets+=($(find $prefix/$col/* -maxdepth 1 -type f -exec basename {} \; | sort -u))
done
scriptlets_str=`echo ${scriptlets[@]} | sed 's/ /\n/g'| sort -u`
COMPREPLY=( $(compgen -W "$scriptlets_str register deregister" -- ${cur}) )
return 0
fi
# handle commands; does not handle commands without single or double quotes
if [[ ${cur} == \'* || ${cur} == \"* ]] ; then
# it is a command do not reply with anything
return 0
fi
# handle collections; if it is not an option or a command, it must be a collection
if [ $prev == "register" ]; then
compopt -o nospace
COMPREPLY=( $(compgen -A directory ${cur}) )
return 0
fi
COMPREPLY=( $(compgen -W "${collections[*]}" -- ${cur}) )
return 0
}
# bind the scl command to the _scl function for completion
complete -F _scl scl