Server IP : 85.214.239.14 / Your IP : 18.188.0.20 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/task/2/root/proc/2/root/usr/share/bash-completion/completions/ |
Upload File : |
# mutt completion -*- shell-script -*- # # Mutt doesn't have an "addressbook" like Pine, but it has aliases and # a "query" function to retrieve addresses, so that's what we use here. # @param $1 (cur) Current word to complete _muttaddr() { _muttaliases "$1" _muttquery "$1" COMPREPLY+=($(compgen -u -- "$1")) } # Find muttrc to use # @output muttrc filename _muttrc() { # Search COMP_WORDS for '-F muttrc' or '-Fmuttrc' argument set -- "${words[@]}" while (($# > 0)); do if [[ $1 == -F* ]]; then if ((${#1} > 2)); then muttrc="$(dequote "${1:2}")" else shift [[ $1 ]] && muttrc="$(dequote "$1")" fi break fi shift done if [[ ! -v muttrc ]]; then if [[ -f ~/.${muttcmd}rc ]]; then muttrc=\~/.${muttcmd}rc elif [[ -f ~/.${muttcmd}/${muttcmd}rc ]]; then muttrc=\~/.${muttcmd}/${muttcmd}rc fi fi printf "%s" "${muttrc-}" } # Recursively build list of sourced config files # @param $1 List of config files found so far # @param $2 Config file to process # @output List of config files _muttconffiles() { local file sofar local -a newconffiles sofar=" $1 " shift while [[ ${1-} ]]; do newconffiles=($(command sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' "$(eval printf %s $1)")) for file in ${newconffiles+"${newconffiles[@]}"}; do __expand_tilde_by_ref file [[ ! -f $file || $sofar == *\ $file\ * ]] && continue sofar+=" $file" sofar=" $(eval _muttconffiles \"$sofar\" $file) " done shift done printf '%s\n' $sofar } # @param $1 (cur) Current word to complete _muttaliases() { local cur=$1 muttrc muttcmd=${words[0]} local -a conffiles aliases muttrc=$(_muttrc) [[ -z $muttrc ]] && return conffiles=($(eval _muttconffiles $muttrc $muttrc)) # shellcheck disable=SC2046 aliases=("$(command sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \ $(eval echo "${conffiles[@]}"))") COMPREPLY+=($(compgen -W "${aliases[*]}" -- "$cur")) } # @param $1 (cur) Current word to complete _muttquery() { local cur=$1 querycmd muttcmd=${words[0]} local -a queryresults querycmd="$($muttcmd -Q query_command 2>/dev/null | command sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|')" if [[ -z $cur || -z $querycmd ]]; then queryresults=() else __expand_tilde_by_ref querycmd queryresults=($($querycmd | command sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p')) fi COMPREPLY+=($(compgen -W "${queryresults[*]}" -- "$cur")) } # @param $1 (cur) Current word to complete _muttfiledir() { local cur=$1 folder muttrc spoolfile muttcmd=${words[0]} muttrc=$(_muttrc) if [[ $cur == [=+]* ]]; then folder="$($muttcmd -F "$muttrc" -Q folder 2>/dev/null | command sed -e 's|^folder=\"\(.*\)\"$|\1|')" : folder:=~/Mail # Match any file in $folder beginning with $cur # (minus the leading '=' sign). compopt -o filenames COMPREPLY=($(compgen -f -- "$folder/${cur:1}")) COMPREPLY=(${COMPREPLY[@]#$folder/}) return elif [[ $cur == !* ]]; then spoolfile="$($muttcmd -F "$muttrc" -Q spoolfile 2>/dev/null | command sed -e 's|^spoolfile=\"\(.*\)\"$|\1|')" [[ -n $spoolfile ]] && eval cur="${cur/^!/$spoolfile}" fi _filedir } _mutt() { local cur prev words cword _init_completion -n =+! || return case $cur in -*) COMPREPLY=($(compgen -W '-A -a -b -c -e -f -F -H -i -m -n -p -Q -R -s -v -x -y -z -Z -h' -- "$cur")) return ;; *) case $prev in -*[afFHi]) _muttfiledir "$cur" return ;; -*A) _muttaliases "$cur" return ;; -*[emQshpRvyzZ]) return ;; *) _muttaddr "$cur" return ;; esac ;; esac } && complete -F _mutt -o default mutt muttng # ex: filetype=sh