Mageia Bugzilla – Attachment 12185 Details for
Bug 28022
In Plasma, Konsole and all other terminal emulators open with abbreviated environment variables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
"set" from am "su -l" session
set2 (text/plain), 215.84 KB, created by
Frank Griffin
on 2021-01-06 02:40:00 CET
(
hide
)
Description:
"set" from am "su -l" session
Filename:
MIME Type:
Creator:
Frank Griffin
Created:
2021-01-06 02:40:00 CET
Size:
215.84 KB
patch
obsolete
>ALLOW_CURDIR_IN_PATH=no >ANT_HOME=/usr >BASH=/bin/bash >BASHOPTS=checkhash:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:histappend:interactive_comments:login_shell:no_empty_cmd_completion:progcomp:promptvars:sourcepath >BASH_ALIASES=() >BASH_ARGC=([0]="0") >BASH_ARGV=() >BASH_CMDS=() >BASH_COMPLETION_VERSINFO=([0]="2" [1]="11") >BASH_LINENO=() >BASH_SOURCE=() >BASH_VERSINFO=([0]="5" [1]="1" [2]="4" [3]="1" [4]="release" [5]="x86_64-mageia-linux-gnu") >BASH_VERSION='5.1.4(1)-release' >BROWSER=firefox >BSNUM=999 >CANBERRA_DRIVER=pulse >CHARSET=ANSI_X3.4-1968 >CLASS=beginner >COLUMNS=81 >COMP_CONFIGURE_HINTS= >COMP_CVS_REMOTE= >COMP_IWLIST_SCAN= >COMP_KNOWN_HOSTS_WITH_AVAHI= >COMP_KNOWN_HOSTS_WITH_HOSTFILE=1 >COMP_TAR_INTERNAL_PATHS= >COMP_WORDBREAKS=$' \t\n"\'><=;|&(:' >CONFIG=/etc/sound/profiles/current/canberra.conf >COUNTRY=US >DIRSTACK=() >DISPLAY=:0 >EDITOR=vi >ENABLE_BASH_COMPLETION=1 >EUID=501 >GCONF_TMPDIR=/tmp >GROUPS=() >G_FILENAME_ENCODING=@locale >HISTCONTROL=ignoredups >HISTFILE=/home/ftg/.bash_history >HISTFILESIZE=1000 >HISTSIZE=1000 >HOME=/home/ftg >HOSTNAME=ftglap >HOSTTYPE=x86_64 >IFS=$' \t\n' >INPUTRC=/etc/inputrc >JAVA_HOME=/etc/alternatives/java_sdk >JBOSS_DIST=/home/jboss/jbossDist >KEYBOARD=us >KEYCHAINFILE=/home/ftg/.keychain/ftglap-sh >KEYCHAINFILEGPG=/home/ftg/.keychain/ftglap-sh-gpg >KEYCHAIN_KEYS= >KEYCHAIN_OPTIONS= >KEYTABLE=us >LADSPA_PATH=/usr/lib64/ladspa/ >LANG=en_US.UTF-8 >LANGUAGE=en_US.UTF-8:en_US:en >LC_SOURCED=1 >LD_LIBRARY_PATH=:/home/ftg/lib >LESSCHARSET=koi8-r >LESSOPEN='|/usr/bin/lesspipe.sh %s' >LINES=20 >LOGNAME=ftg >LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.iso=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.JPG=01;35:*.JPEG=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.ico=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.divx=01;35:*.xvid=01;35:*.3gp=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.gem=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*.mp2=00;36:*.mod=00;36:*.xm=00;36:*.s3m=00;36:*.it=00;36:*.wma=00;36:*~=47;30:*.bak=47;30:*.swp=47;30:*.bck=47;30:*.bk=47;30:*.old=47;30:*.tmp=47;30:*.save=47;30:*.rpmsave=47;30:*.rpmnew=47;30:' >LS_OPTIONS='-Fhd --color=auto --full-time' >M2=/usr/local/apache-maven/bin >M2_HOME=/usr/local/apache-maven >MACHTYPE=x86_64-mageia-linux-gnu >MAIL=/var/spool/mail/ftg >MAILCHECK=60 >META_CLASS=download >MGA_MENU_STYLE=mageia >NLSPATH=/usr/share/locale/%l/%N >OPTERR=1 >OPTIND=1 >OSTYPE=linux-gnu >PATH=/etc/alternatives/java_sdk/bin:/etc/alternatives/java_sdk/jre/bin:/usr/local/apache-maven/bin:/opt/ibm/java2-i386-50/jre/bin:/opt/ibm/java2-i386-50/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/lib64/qt5/bin:/usr/lib64/qt4/bin:/usr/lib/oracle/11.2/client64/bin:/home/ftg/bin >PILOTPORT=usb: >PIPESTATUS=([0]="0") >PPID=125479 >PROMPT_COMMAND='history -a; ' >PS1=$'\\[\017\E[10;0m\E[1;32m\\][\\u@\\h \\w]\\$ \\[\017\E[10;0m\\]' >PS2='> ' >PS4='+ ' >PWD=/home/ftg >PYTHONSTARTUP=/etc/pythonrc.py >QT4DOCDIR=/usr/share/doc/qt4 >QT5DOCDIR=/usr/share/doc/qt5 >QTDIR=/usr/lib64/qt4 >QTDIR5=/usr/lib64/qt5 >QTINC=/usr/lib/qt3/include >QTLIB=/usr/lib64 >QT_XFT=0 >SAL_USE_VCLPLUGIN=gtk >SCREENDIR=/home/ftg/tmp >SECSHELL=1 >SECURE_TMP=no >SECURITY=3 >SHELL=/bin/bash >SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor >SHLVL=1 >SSH_ASKPASS=/usr/libexec/openssh/ssh-askpass >SYSTEMD_PAGER='/usr/bin/less -FR' >TERM=xterm-256color >TMOUT=0 >TMP=/tmp >TMPDIR=/tmp >UID=501 >UMASK_ROOT=022 >UMASK_USER=022 >USER=ftg >XAUTHORITY=/home/ftg/.xauthcRgvTk >XDG_DATA_DIRS=/home/ftg/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share >XkbLayout=us >XkbModel=pc105 >XkbOptions=compose:rwin >_=set >__git_all_commands= >__git_am_inprogress_options='--skip --continue --resolved --abort --quit --show-current-patch' >__git_cherry_pick_inprogress_options='--continue --quit --abort --skip' >__git_cmds_with_parseopt_helper= >__git_color_moved_opts='no default plain blocks zebra dimmed-zebra' >__git_color_moved_ws_opts=$'no ignore-space-at-eol ignore-space-change\n\t\t\tignore-all-space allow-indentation-change' >__git_config_vars= >__git_diff_algorithms='myers minimal patience histogram' >__git_diff_common_options=$'--stat --numstat --shortstat --summary\n\t\t\t--patch-with-stat --name-only --name-status --color\n\t\t\t--no-color --color-words --no-renames --check\n\t\t\t--color-moved --color-moved= --no-color-moved\n\t\t\t--color-moved-ws= --no-color-moved-ws\n\t\t\t--full-index --binary --abbrev --diff-filter=\n\t\t\t--find-copies-harder --ignore-cr-at-eol\n\t\t\t--text --ignore-space-at-eol --ignore-space-change\n\t\t\t--ignore-all-space --ignore-blank-lines --exit-code\n\t\t\t--quiet --ext-diff --no-ext-diff\n\t\t\t--no-prefix --src-prefix= --dst-prefix=\n\t\t\t--inter-hunk-context=\n\t\t\t--patience --histogram --minimal\n\t\t\t--raw --word-diff --word-diff-regex=\n\t\t\t--dirstat --dirstat= --dirstat-by-file\n\t\t\t--dirstat-by-file= --cumulative\n\t\t\t--diff-algorithm=\n\t\t\t--submodule --submodule= --ignore-submodules\n\t\t\t--indent-heuristic --no-indent-heuristic\n\t\t\t--textconv --no-textconv\n\t\t\t--patch --no-patch\n' >__git_diff_difftool_options=$'--cached --staged --pickaxe-all --pickaxe-regex\n\t\t\t--base --ours --theirs --no-index --relative --merge-base\n\t\t\t--stat --numstat --shortstat --summary\n\t\t\t--patch-with-stat --name-only --name-status --color\n\t\t\t--no-color --color-words --no-renames --check\n\t\t\t--color-moved --color-moved= --no-color-moved\n\t\t\t--color-moved-ws= --no-color-moved-ws\n\t\t\t--full-index --binary --abbrev --diff-filter=\n\t\t\t--find-copies-harder --ignore-cr-at-eol\n\t\t\t--text --ignore-space-at-eol --ignore-space-change\n\t\t\t--ignore-all-space --ignore-blank-lines --exit-code\n\t\t\t--quiet --ext-diff --no-ext-diff\n\t\t\t--no-prefix --src-prefix= --dst-prefix=\n\t\t\t--inter-hunk-context=\n\t\t\t--patience --histogram --minimal\n\t\t\t--raw --word-diff --word-diff-regex=\n\t\t\t--dirstat --dirstat= --dirstat-by-file\n\t\t\t--dirstat-by-file= --cumulative\n\t\t\t--diff-algorithm=\n\t\t\t--submodule --submodule= --ignore-submodules\n\t\t\t--indent-heuristic --no-indent-heuristic\n\t\t\t--textconv --no-textconv\n\t\t\t--patch --no-patch\n' >__git_diff_submodule_formats='diff log short' >__git_fetch_recurse_submodules='yes on-demand no' >__git_format_patch_extra_options=$'\n\t--full-index --not --all --no-prefix --src-prefix=\n\t--dst-prefix= --notes\n' >__git_log_common_options=$'\n\t--not --all\n\t--branches --tags --remotes\n\t--first-parent --merges --no-merges\n\t--max-count=\n\t--max-age= --since= --after=\n\t--min-age= --until= --before=\n\t--min-parents= --max-parents=\n\t--no-min-parents --no-max-parents\n' >__git_log_date_formats='relative iso8601 iso8601-strict rfc2822 short local default raw unix format:' >__git_log_gitk_options=$'\n\t--dense --sparse --full-history\n\t--simplify-merges --simplify-by-decoration\n\t--left-right --notes --no-notes\n' >__git_log_pretty_formats='oneline short medium full fuller reference email raw format: tformat: mboxrd' >__git_log_shortlog_options=$'\n\t--author= --committer= --grep=\n\t--all-match --invert-grep\n' >__git_merge_strategies= >__git_merge_strategy_options=$'ours theirs subtree subtree= patience\n\thistogram diff-algorithm= ignore-space-change ignore-all-space\n\tignore-space-at-eol renormalize no-renormalize no-renames\n\tfind-renames find-renames= rename-threshold=' >__git_mergetools_common=$'diffuse diffmerge ecmerge emerge kdiff3 meld opendiff\n\t\t\ttkdiff vimdiff nvimdiff gvimdiff xxdiff araxis p4merge\n\t\t\tbc codecompare smerge\n' >__git_patchformat='mbox stgit stgit-series hg mboxrd' >__git_printf_supports_v=yes >__git_push_recurse_submodules='check on-demand only' >__git_rebase_inprogress_options='--continue --skip --abort --quit --show-current-patch' >__git_rebase_interactive_inprogress_options='--continue --skip --abort --quit --show-current-patch --edit-todo' >__git_ref_fieldlist='refname objecttype objectsize objectname upstream push HEAD symref' >__git_revert_inprogress_options='--continue --quit --abort --skip' >__git_send_email_confirm_options='always never auto cc compose' >__git_send_email_suppresscc_options='author self cc bodycc sob cccmd body all' >__git_sequencer_inprogress_options='--continue --quit --abort --skip' >__git_showcurrentpatch='diff raw' >__git_untracked_file_modes='all no normal' >__git_whitespacelist='nowarn warn error error-all fix' >_backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))' >_xspecs=([tex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [freeamp]="!*.@(mp3|ogg|pls|m3u)" [gqmpeg]="!*.@(mp3|ogg|pls|m3u)" [texi2html]="!*.texi*" [hbpp]="!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])" [lowriter]="!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm|pdf)" [rpm2cpio]="!*.[rs]pm" [localc]="!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|?(f)ods|ots)" [hbrun]="!*.[Hh][Rr][Bb]" [vi]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [latex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [view]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [madplay]="!*.mp3" [compress]="*.Z" [pdfjadetex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [pbunzip2]="!*.?(t)bz?(2)" [lrunzip]="!*.lrz" [gunzip]="!*.@(Z|[gGd]z|t[ag]z)" [oowriter]="!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm|pdf)" [epiphany]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [acroread]="!*.[pf]df" [znew]="*.Z" [kwrite]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [xemacs]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [gview]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [lzfgrep]="!*.@(tlz|lzma)" [lzless]="!*.@(tlz|lzma)" [cdiff]="!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))" [zipinfo]="!*.@(zip|[aegjswx]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|epub|apk|aab|ipa|do[ct][xm]|p[op]t[mx]|xl[st][xm]|pyz|whl)" [pdflatex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [portecle]="!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath|pem|p10|csr|crl)|cacerts)" [modplugplay]="!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|oct|okt?(a)|p[st]m|s[3t]m|ult|umx|wav|xm)" [lokalize]="!*.po" [lbzcat]="!*.?(t)bz?(2)" [qiv]="!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|svg)" [totem]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [ps2pdfwr]="!*.@(?(e)ps|pdf)" [dvitype]="!*.dvi" [unpigz]="!*.@(Z|[gGdz]z|t[ag]z)" [mozilla]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [pdfunite]="!*.pdf" [gpdf]="!*.[pf]df" [texi2dvi]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [bunzip2]="!*.?(t)bz?(2)" [zathura]="!*.@(cb[rz7t]|djv?(u)|?(e)ps|pdf)" [kaffeine]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [mpg123]="!*.mp3" [lzegrep]="!*.@(tlz|lzma)" [xv]="!*.@(gif|jp?(e)g?(2)|j2[ck]|jp[2f]|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|?(e)ps)" [xdvi]="!*.@(dvi|DVI)?(.@(gz|Z|bz2))" [xfig]="!*.fig" [xpdf]="!*.[pf]df" [oobase]="!*.odb" [xelatex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [gharbour]="!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])" [bzcat]="!*.?(t)bz?(2)" [dragon]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [xanim]="!*.@(mpg|mpeg|avi|mov|qt)" [lualatex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [rgview]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [rvim]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [xetex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [lomath]="!*.@(sxm|smf|mml|odf)" [zcat]="!*.@(Z|[gGd]z|t[ag]z)" [lynx]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [uncompress]="!*.Z" [xzcat]="!*.@(?(t)xz|tlz|lzma)" [vim]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [loimpress]="!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|?(f)odp|otp)" [dvipdf]="!*.dvi" [mpg321]="!*.mp3" [jadetex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [lobase]="!*.odb" [epdfview]="!*.pdf" [ps2pdf14]="!*.@(?(e)ps|pdf)" [ps2pdf13]="!*.@(?(e)ps|pdf)" [ps2pdf12]="!*.@(?(e)ps|pdf)" [poedit]="!*.po" [luatex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [kbabel]="!*.po" [bzme]="!*.@(zip|z|gz|tgz)" [dviselect]="!*.dvi" [realplay]="!*.@(rm?(j)|ra?(m)|smi?(l))" [kdvi]="!*.@(dvi|DVI)?(.@(gz|Z|bz2))" [elinks]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [kghostview]="!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))" [gtranslator]="!*.po" [unzip]="!*.@(zip|[aegjswx]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|epub|apk|aab|ipa|do[ct][xm]|p[op]t[mx]|xl[st][xm]|pyz|whl)" [ggv]="!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))" [oomath]="!*.@(sxm|smf|mml|odf)" [dvipdfmx]="!*.dvi" [makeinfo]="!*.texi*" [okular]="!*.@(okular|@(?(e|x)ps|?(E|X)PS|[pf]df|[PF]DF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX|epub|EPUB|odt|ODT|fb?(2)|FB?(2)|mobi|MOBI|g3|G3|chm|CHM)?(.?(gz|GZ|bz2|BZ2|xz|XZ)))" [sxemacs]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [aviplay]="!*.@(avi|asf|wmv)" [rgvim]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [dvipdfm]="!*.dvi" [ly2dvi]="!*.ly" [oodraw]="!*.@(sxd|std|sda|sdd|?(f)odg|otg)" [kpdf]="!*.@(?(e)ps|pdf)" [bibtex]="!*.aux" [netscape]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [emacs]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [rview]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [galeon]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [dillo]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [fbxine]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [oocalc]="!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|?(f)ods|ots)" [harbour]="!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])" [lodraw]="!*.@(sxd|std|sda|sdd|?(f)odg|otg)" [dvips]="!*.dvi" [ps2pdf]="!*.@(?(e)ps|pdf)" [kate]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [kid3-qt]="!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)" [pdftex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [gvim]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [timidity]="!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)" [ogg123]="!*.@(og[ag]|m3u|flac|spx)" [lzgrep]="!*.@(tlz|lzma)" [ee]="!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)" [unlzma]="!*.@(tlz|lzma)" [lbunzip2]="!*.?(t)bz?(2)" [ooimpress]="!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|?(f)odp|otp)" [xine]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [amaya]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [gv]="!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))" [kid3]="!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)" [lilypond]="!*.ly" [modplug123]="!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|oct|okt?(a)|p[st]m|s[3t]m|ult|umx|wav|xm)" [pbzcat]="!*.?(t)bz?(2)" [unxz]="!*.@(?(t)xz|tlz|lzma)" [playmidi]="!*.@(mid?(i)|cmf)" [lzcat]="!*.@(tlz|lzma)" [slitex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [aaxine]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [advi]="!*.dvi" [lzmore]="!*.@(tlz|lzma)" ) >color=32m >colorregex='3[12]m' >common_options='-q --quiet -v --verbose --debug -h --help --urpmi-root --wait-lock' >loginsh=1 >new_dirs=/home/ftg/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share >psclear=$'\E[0m' >pscolor=$'\E[1;32m' >psreset=$'\017\E[10;0m' >python=/usr/share/man/man1/python.1.xz >__expand_tilde_by_ref () >{ > if [[ ${!1-} == \~* ]]; then > eval $1="$(printf ~%q "${!1#\~}")"; > fi >} >__get_cword_at_cursor_by_ref () >{ > local cword words=(); > __reassemble_comp_words_by_ref "$1" words cword; > local i cur="" index=$COMP_POINT lead=${COMP_LINE:0:COMP_POINT}; > if [[ $index -gt 0 && ( -n $lead && -n ${lead//[[:space:]]/} ) ]]; then > cur=$COMP_LINE; > for ((i = 0; i <= cword; ++i)) > do > while [[ ${#cur} -ge ${#words[i]} && ${cur:0:${#words[i]}} != "${words[i]-}" ]]; do > cur="${cur:1}"; > ((index > 0)) && ((index--)); > done; > if ((i < cword)); then > local old_size=${#cur}; > cur="${cur#"${words[i]}"}"; > local new_size=${#cur}; > ((index -= old_size - new_size)); > fi; > done; > [[ -n $cur && ! -n ${cur//[[:space:]]/} ]] && cur=; > ((index < 0)) && index=0; > fi; > local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 ${words+"${words[@]}"} -v $3 "$cword" -v $4 "${cur:0:index}" >} >__git () >{ > git ${__git_C_args:+"${__git_C_args[@]}"} ${__git_dir:+--git-dir="$__git_dir"} "$@" 2> /dev/null >} >__git_aliased_command () >{ > local cur=$1 last list word cmdline; > while [[ -n "$cur" ]]; do > if [[ "$list" == *" $cur "* ]]; then > return; > fi; > cmdline=$(__git config --get "alias.$cur"); > list=" $cur $list"; > last=$cur; > cur=; > for word in $cmdline; > do > case "$word" in > \!gitk | gitk) > cur="gitk"; > break > ;; > \!*) > : shell command alias > ;; > -*) > : option > ;; > *=*) > : setting env > ;; > git) > : git itself > ;; > \(\)) > : skip parens of shell function definition > ;; > {) > : skip start of shell helper function > ;; > :) > : skip null command > ;; > \'*) > : skip opening quote after sh -c > ;; > *) > cur="$word"; > break > ;; > esac; > done; > done; > cur=$last; > if [[ "$cur" != "$1" ]]; then > echo "$cur"; > fi >} >__git_checkout_default_dwim_mode () >{ > local last_option dwim_opt="--dwim"; > if [ "${GIT_COMPLETION_CHECKOUT_NO_GUESS-}" = "1" ]; then > dwim_opt=""; > fi; > if [ -n "$(__git_find_on_cmdline "--no-track")" ]; then > dwim_opt=""; > fi; > if [ "$(__git config --type=bool checkout.guess)" = "false" ]; then > dwim_opt=""; > fi; > last_option="$(__git_find_last_on_cmdline "--guess --no-guess")"; > case "$last_option" in > --guess) > dwim_opt="--dwim" > ;; > --no-guess) > dwim_opt="" > ;; > esac; > echo "$dwim_opt" >} >__git_complete () >{ > local wrapper="__git_wrap${2}"; > eval "$wrapper () { __git_func_wrap $2 ; }"; > complete -o bashdefault -o default -o nospace -F $wrapper $1 2> /dev/null || complete -o default -o nospace -F $wrapper $1 >} >__git_complete_command () >{ > local command="$1"; > local completion_func="_git_${command//-/_}"; > if ! declare -f $completion_func > /dev/null 2> /dev/null && declare -f _completion_loader > /dev/null 2> /dev/null; then > _completion_loader "git-$command"; > fi; > if declare -f $completion_func > /dev/null 2> /dev/null; then > $completion_func; > return 0; > else > if __git_support_parseopt_helper "$command"; then > __git_complete_common "$command"; > return 0; > else > return 1; > fi; > fi >} >__git_complete_common () >{ > local command="$1"; > case "$cur" in > --*) > __gitcomp_builtin "$command" > ;; > esac >} >__git_complete_config_variable_name () >{ > local cur_="$cur" sfx; > while test $# != 0; do > case "$1" in > --cur=*) > cur_="${1##--cur=}" > ;; > --sfx=*) > sfx="${1##--sfx=}" > ;; > *) > return 1 > ;; > esac; > shift; > done; > case "$cur_" in > branch.*.*) > local pfx="${cur_%.*}."; > cur_="${cur_##*.}"; > __gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_" "$sfx"; > return > ;; > branch.*) > local pfx="${cur%.*}."; > cur_="${cur#*.}"; > __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"; > __gitcomp_nl_append 'autoSetupMerge >autoSetupRebase >' "$pfx" "$cur_" "$sfx"; > return > ;; > guitool.*.*) > local pfx="${cur_%.*}."; > cur_="${cur_##*.}"; > __gitcomp " > argPrompt cmd confirm needsFile noConsole noRescan > prompt revPrompt revUnmerged title > " "$pfx" "$cur_" "$sfx"; > return > ;; > difftool.*.*) > local pfx="${cur_%.*}."; > cur_="${cur_##*.}"; > __gitcomp "cmd path" "$pfx" "$cur_" "$sfx"; > return > ;; > man.*.*) > local pfx="${cur_%.*}."; > cur_="${cur_##*.}"; > __gitcomp "cmd path" "$pfx" "$cur_" "$sfx"; > return > ;; > mergetool.*.*) > local pfx="${cur_%.*}."; > cur_="${cur_##*.}"; > __gitcomp "cmd path trustExitCode" "$pfx" "$cur_" "$sfx"; > return > ;; > pager.*) > local pfx="${cur_%.*}."; > cur_="${cur_#*.}"; > __git_compute_all_commands; > __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "$sfx"; > return > ;; > remote.*.*) > local pfx="${cur_%.*}."; > cur_="${cur_##*.}"; > __gitcomp " > url proxy fetch push mirror skipDefaultUpdate > receivepack uploadpack tagOpt pushurl > " "$pfx" "$cur_" "$sfx"; > return > ;; > remote.*) > local pfx="${cur_%.*}."; > cur_="${cur_#*.}"; > __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."; > __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "$sfx"; > return > ;; > url.*.*) > local pfx="${cur_%.*}."; > cur_="${cur_##*.}"; > __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" "$sfx"; > return > ;; > *.*) > __git_compute_config_vars; > __gitcomp "$__git_config_vars" "" "$cur_" "$sfx" > ;; > *) > __git_compute_config_vars; > __gitcomp "$(echo "$__git_config_vars" | > awk -F . '{ > sections[$1] = 1 > } > END { > for (s in sections) > print s "." > } > ')" "" "$cur_" > ;; > esac >} >__git_complete_config_variable_name_and_value () >{ > local cur_="$cur"; > while test $# != 0; do > case "$1" in > --cur=*) > cur_="${1##--cur=}" > ;; > *) > return 1 > ;; > esac; > shift; > done; > case "$cur_" in > *=*) > __git_complete_config_variable_value --varname="${cur_%%=*}" --cur="${cur_#*=}" > ;; > *) > __git_complete_config_variable_name --cur="$cur_" --sfx='=' > ;; > esac >} >__git_complete_config_variable_value () >{ > local varname="$prev" cur_="$cur"; > while test $# != 0; do > case "$1" in > --varname=*) > varname="${1##--varname=}" > ;; > --cur=*) > cur_="${1##--cur=}" > ;; > *) > return 1 > ;; > esac; > shift; > done; > if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then > varname="${varname,,}"; > else > varname="$(echo "$varname" |tr A-Z a-z)"; > fi; > case "$varname" in > branch.*.remote | branch.*.pushremote) > __gitcomp_nl "$(__git_remotes)" "" "$cur_"; > return > ;; > branch.*.merge) > __git_complete_refs --cur="$cur_"; > return > ;; > branch.*.rebase) > __gitcomp "false true merges preserve interactive" "" "$cur_"; > return > ;; > remote.pushdefault) > __gitcomp_nl "$(__git_remotes)" "" "$cur_"; > return > ;; > remote.*.fetch) > local remote="${varname#remote.}"; > remote="${remote%.fetch}"; > if [ -z "$cur_" ]; then > __gitcomp_nl "refs/heads/" "" "" ""; > return; > fi; > __gitcomp_nl "$(__git_refs_remotes "$remote")" "" "$cur_"; > return > ;; > remote.*.push) > local remote="${varname#remote.}"; > remote="${remote%.push}"; > __gitcomp_nl "$(__git for-each-ref --format='%(refname):%(refname)' refs/heads)" "" "$cur_"; > return > ;; > pull.twohead | pull.octopus) > __git_compute_merge_strategies; > __gitcomp "$__git_merge_strategies" "" "$cur_"; > return > ;; > color.pager) > __gitcomp "false true" "" "$cur_"; > return > ;; > color.*.*) > __gitcomp " > normal black red green yellow blue magenta cyan white > bold dim ul blink reverse > " "" "$cur_"; > return > ;; > color.*) > __gitcomp "false true always never auto" "" "$cur_"; > return > ;; > diff.submodule) > __gitcomp "$__git_diff_submodule_formats" "" "$cur_"; > return > ;; > help.format) > __gitcomp "man info web html" "" "$cur_"; > return > ;; > log.date) > __gitcomp "$__git_log_date_formats" "" "$cur_"; > return > ;; > sendemail.aliasfiletype) > __gitcomp "mutt mailrc pine elm gnus" "" "$cur_"; > return > ;; > sendemail.confirm) > __gitcomp "$__git_send_email_confirm_options" "" "$cur_"; > return > ;; > sendemail.suppresscc) > __gitcomp "$__git_send_email_suppresscc_options" "" "$cur_"; > return > ;; > sendemail.transferencoding) > __gitcomp "7bit 8bit quoted-printable base64" "" "$cur_"; > return > ;; > *.*) > return > ;; > esac >} >__git_complete_fetch_refspecs () >{ > local i remote="$1" pfx="${2-}" cur_="${3-$cur}" sfx="${4- }"; > __gitcomp_direct "$( > for i in $(__git_refs "$remote" "" "" "$cur_") ; do > echo "$pfx$i:$i$sfx" > done > )" >} >__git_complete_file () >{ > __git_complete_revlist_file >} >__git_complete_force_with_lease () >{ > local cur_=$1; > case "$cur_" in > --*=) > > ;; > *:*) > __git_complete_refs --cur="${cur_#*:}" > ;; > *) > __git_complete_refs --cur="$cur_" > ;; > esac >} >__git_complete_index_file () >{ > local dequoted_word pfx="" cur_; > __git_dequote "$cur"; > case "$dequoted_word" in > ?*/*) > pfx="${dequoted_word%/*}/"; > cur_="${dequoted_word##*/}" > ;; > *) > cur_="$dequoted_word" > ;; > esac; > __gitcomp_file_direct "$(__git_index_files "$1" "$pfx" "$cur_")" >} >__git_complete_refs () >{ > local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs"; > while test $# != 0; do > case "$1" in > --remote=*) > remote="${1##--remote=}" > ;; > --dwim) > dwim="yes" > ;; > --track) > dwim="yes" > ;; > --pfx=*) > pfx="${1##--pfx=}" > ;; > --cur=*) > cur_="${1##--cur=}" > ;; > --sfx=*) > sfx="${1##--sfx=}" > ;; > --mode=*) > mode="${1##--mode=}" > ;; > *) > return 1 > ;; > esac; > shift; > done; > case "$mode" in > refs) > __gitcomp_direct "$(__git_refs "$remote" "" "$pfx" "$cur_" "$sfx")" > ;; > heads) > __gitcomp_direct "$(__git_heads "$pfx" "$cur_" "$sfx")" > ;; > remote-heads) > __gitcomp_direct "$(__git_remote_heads "$pfx" "$cur_" "$sfx")" > ;; > *) > return 1 > ;; > esac; > if [ "$dwim" = "yes" ]; then > __gitcomp_direct_append "$(__git_dwim_remote_heads "$pfx" "$cur_" "$sfx")"; > fi >} >__git_complete_remote_or_refspec () >{ > local cur_="$cur" cmd="${words[1]}"; > local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0; > if [ "$cmd" = "remote" ]; then > ((c++)); > fi; > while [ $c -lt $cword ]; do > i="${words[c]}"; > case "$i" in > --mirror) > [ "$cmd" = "push" ] && no_complete_refspec=1 > ;; > -d | --delete) > [ "$cmd" = "push" ] && lhs=0 > ;; > --all) > case "$cmd" in > push) > no_complete_refspec=1 > ;; > fetch) > return > ;; > *) > > ;; > esac > ;; > --multiple) > no_complete_refspec=1; > break > ;; > -*) > > ;; > *) > remote="$i"; > break > ;; > esac; > ((c++)); > done; > if [ -z "$remote" ]; then > __gitcomp_nl "$(__git_remotes)"; > return; > fi; > if [ $no_complete_refspec = 1 ]; then > return; > fi; > [ "$remote" = "." ] && remote=; > case "$cur_" in > *:*) > case "$COMP_WORDBREAKS" in > *:*) > : great > ;; > *) > pfx="${cur_%%:*}:" > ;; > esac; > cur_="${cur_#*:}"; > lhs=0 > ;; > +*) > pfx="+"; > cur_="${cur_#+}" > ;; > esac; > case "$cmd" in > fetch) > if [ $lhs = 1 ]; then > __git_complete_fetch_refspecs "$remote" "$pfx" "$cur_"; > else > __git_complete_refs --pfx="$pfx" --cur="$cur_"; > fi > ;; > pull | remote) > if [ $lhs = 1 ]; then > __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"; > else > __git_complete_refs --pfx="$pfx" --cur="$cur_"; > fi > ;; > push) > if [ $lhs = 1 ]; then > __git_complete_refs --pfx="$pfx" --cur="$cur_"; > else > __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"; > fi > ;; > esac >} >__git_complete_revlist () >{ > __git_complete_revlist_file >} >__git_complete_revlist_file () >{ > local dequoted_word pfx ls ref cur_="$cur"; > case "$cur_" in > *..?*:*) > return > ;; > ?*:*) > ref="${cur_%%:*}"; > cur_="${cur_#*:}"; > __git_dequote "$cur_"; > case "$dequoted_word" in > ?*/*) > pfx="${dequoted_word%/*}"; > cur_="${dequoted_word##*/}"; > ls="$ref:$pfx"; > pfx="$pfx/" > ;; > *) > cur_="$dequoted_word"; > ls="$ref" > ;; > esac; > case "$COMP_WORDBREAKS" in > *:*) > : great > ;; > *) > pfx="$ref:$pfx" > ;; > esac; > __gitcomp_file "$(__git ls-tree "$ls" | sed 's/^.* // > s/$//')" "$pfx" "$cur_" > ;; > *...*) > pfx="${cur_%...*}..."; > cur_="${cur_#*...}"; > __git_complete_refs --pfx="$pfx" --cur="$cur_" > ;; > *..*) > pfx="${cur_%..*}.."; > cur_="${cur_#*..}"; > __git_complete_refs --pfx="$pfx" --cur="$cur_" > ;; > *) > __git_complete_refs > ;; > esac >} >__git_complete_strategy () >{ > __git_compute_merge_strategies; > case "$prev" in > -s | --strategy) > __gitcomp "$__git_merge_strategies"; > return 0 > ;; > -X) > __gitcomp "$__git_merge_strategy_options"; > return 0 > ;; > esac; > case "$cur" in > --strategy=*) > __gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}"; > return 0 > ;; > --strategy-option=*) > __gitcomp "$__git_merge_strategy_options" "" "${cur##--strategy-option=}"; > return 0 > ;; > esac; > return 1 >} >__git_complete_symbol () >{ > local tags=tags pfx="" cur_="${cur-}" sfx=" "; > while test $# != 0; do > case "$1" in > --tags=*) > tags="${1##--tags=}" > ;; > --pfx=*) > pfx="${1##--pfx=}" > ;; > --cur=*) > cur_="${1##--cur=}" > ;; > --sfx=*) > sfx="${1##--sfx=}" > ;; > *) > return 1 > ;; > esac; > shift; > done; > if test -r "$tags"; then > __gitcomp_direct "$(__git_match_ctag "$cur_" "$tags" "$pfx" "$sfx")"; > fi >} >__git_complete_worktree_paths () >{ > local IFS=' >'; > __gitcomp_nl "$(git worktree list --porcelain | > # Skip the first entry: it's the path of the main worktree, > # which can't be moved, removed, locked, etc. > sed -n -e '2,$ s/^worktree //p')" >} >__git_compute_all_commands () >{ > test -n "$__git_all_commands" || __git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers) >} >__git_compute_config_vars () >{ > test -n "$__git_config_vars" || __git_config_vars="$(git help --config-for-completion | sort -u)" >} >__git_compute_merge_strategies () >{ > test -n "$__git_merge_strategies" || __git_merge_strategies=$(__git_list_merge_strategies) >} >__git_config_get_set_variables () >{ > local prevword word config_file= c=$cword; > while [ $c -gt 1 ]; do > word="${words[c]}"; > case "$word" in > --system | --global | --local | --file=*) > config_file="$word"; > break > ;; > -f | --file) > config_file="$word $prevword"; > break > ;; > esac; > prevword=$word; > c=$((--c)); > done; > __git config $config_file --name-only --list >} >__git_count_arguments () >{ > local word i c=0; > for ((i=1; i < ${#words[@]}; i++)) > do > word="${words[i]}"; > case "$word" in > --) > ((c = 0)) > ;; > "$1") > ((c = 0)) > ;; > ?*) > ((c++)) > ;; > esac; > done; > printf "%d" $c >} >__git_dequote () >{ > local rest="$1" len ch; > dequoted_word=""; > while test -n "$rest"; do > len=${#dequoted_word}; > dequoted_word="$dequoted_word${rest%%[\\\'\"]*}"; > rest="${rest:$((${#dequoted_word}-$len))}"; > case "${rest:0:1}" in > \\) > ch="${rest:1:1}"; > case "$ch" in > ' >') > > ;; > *) > dequoted_word="$dequoted_word$ch" > ;; > esac; > rest="${rest:2}" > ;; > \') > rest="${rest:1}"; > len=${#dequoted_word}; > dequoted_word="$dequoted_word${rest%%\'*}"; > rest="${rest:$((${#dequoted_word}-$len+1))}" > ;; > \") > rest="${rest:1}"; > while test -n "$rest"; do > len=${#dequoted_word}; > dequoted_word="$dequoted_word${rest%%[\\\"]*}"; > rest="${rest:$((${#dequoted_word}-$len))}"; > case "${rest:0:1}" in > \\) > ch="${rest:1:1}"; > case "$ch" in > \" | \\ | \$ | \`) > dequoted_word="$dequoted_word$ch" > ;; > ' >') > > ;; > *) > dequoted_word="$dequoted_word\\$ch" > ;; > esac; > rest="${rest:2}" > ;; > \") > rest="${rest:1}"; > break > ;; > esac; > done > ;; > esac; > done >} >__git_dwim_remote_heads () >{ > local pfx="${1-}" cur_="${2-}" sfx="${3-}"; > local fer_pfx="${pfx//\%/%%}"; > __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" --sort="refname:strip=3" "refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | uniq -u >} >__git_eread () >{ > test -r "$1" && IFS=' >' read "$2" < "$1" >} >__git_find_last_on_cmdline () >{ > local word c=$cword show_idx; > while test $# -gt 1; do > case "$1" in > --show-idx) > show_idx=y > ;; > *) > return 1 > ;; > esac; > shift; > done; > local wordlist="$1"; > while [ $c -gt 1 ]; do > ((c--)); > for word in $wordlist; > do > if [ "$word" = "${words[c]}" ]; then > if [ -n "$show_idx" ]; then > echo "$c $word"; > else > echo "$word"; > fi; > return; > fi; > done; > done >} >__git_find_on_cmdline () >{ > local word c=1 show_idx; > while test $# -gt 1; do > case "$1" in > --show-idx) > show_idx=y > ;; > *) > return 1 > ;; > esac; > shift; > done; > local wordlist="$1"; > while [ $c -lt $cword ]; do > for word in $wordlist; > do > if [ "$word" = "${words[c]}" ]; then > if [ -n "${show_idx-}" ]; then > echo "$c $word"; > else > echo "$word"; > fi; > return; > fi; > done; > ((c++)); > done >} >__git_find_repo_path () >{ > if [ -n "${__git_repo_path-}" ]; then > return; > fi; > if [ -n "${__git_C_args-}" ]; then > __git_repo_path="$(git "${__git_C_args[@]}" ${__git_dir:+--git-dir="$__git_dir"} rev-parse --absolute-git-dir 2>/dev/null)"; > else > if [ -n "${__git_dir-}" ]; then > test -d "$__git_dir" && __git_repo_path="$__git_dir"; > else > if [ -n "${GIT_DIR-}" ]; then > test -d "${GIT_DIR-}" && __git_repo_path="$GIT_DIR"; > else > if [ -d .git ]; then > __git_repo_path=.git; > else > __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)"; > fi; > fi; > fi; > fi >} >__git_func_wrap () >{ > local cur words cword prev; > _get_comp_words_by_ref -n =: cur words cword prev; > $1 >} >__git_get_config_variables () >{ > local section="$1" i IFS=' >'; > for i in $(__git config --name-only --get-regexp "^$section\..*"); > do > echo "${i#$section.}"; > done >} >__git_get_option_value () >{ > local c short_opt long_opt val; > local result= values config_key word; > short_opt="$1"; > long_opt="$2"; > values="$3"; > config_key="$4"; > ((c = $cword - 1)); > while [ $c -ge 0 ]; do > word="${words[c]}"; > for val in $values; > do > if [ "$short_opt$val" = "$word" ] || [ "$long_opt$val" = "$word" ]; then > result="$val"; > break 2; > fi; > done; > ((c--)); > done; > if [ -n "$config_key" ] && [ -z "$result" ]; then > result="$(__git config "$config_key")"; > fi; > echo "$result" >} >__git_has_doubledash () >{ > local c=1; > while [ $c -lt $cword ]; do > if [ "--" = "${words[c]}" ]; then > return 0; > fi; > ((c++)); > done; > return 1 >} >__git_heads () >{ > local pfx="${1-}" cur_="${2-}" sfx="${3-}"; > __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" "refs/heads/$cur_*" "refs/heads/$cur_*/**" >} >__git_index_files () >{ > local root="$2" match="$3"; > __git_ls_files_helper "$root" "$1" "${match:-?}" | awk -F / -v pfx="${2//\\/\\\\}" '{ > paths[$1] = 1 > } > END { > for (p in paths) { > if (substr(p, 1, 1) != "\"") { > # No special characters, easy! > print pfx p > continue > } > > # The path is quoted. > p = dequote(p) > if (p == "") > continue > > # Even when a directory name itself does not contain > # any special characters, it will still be quoted if > # any of its (stripped) trailing path components do. > # Because of this we may have seen the same directory > # both quoted and unquoted. > if (p in paths) > # We have seen the same directory unquoted, > # skip it. > continue > else > print pfx p > } > } > function dequote(p, bs_idx, out, esc, esc_idx, dec) { > # Skip opening double quote. > p = substr(p, 2) > > # Interpret backslash escape sequences. > while ((bs_idx = index(p, "\\")) != 0) { > out = out substr(p, 1, bs_idx - 1) > esc = substr(p, bs_idx + 1, 1) > p = substr(p, bs_idx + 2) > > if ((esc_idx = index("abtvfr\"\\", esc)) != 0) { > # C-style one-character escape sequence. > out = out substr("\a\b\t\v\f\r\"\\", > esc_idx, 1) > } else if (esc == "n") { > # Uh-oh, a newline character. > # We cannot reliably put a pathname > # containing a newline into COMPREPLY, > # and the newline would create a mess. > # Skip this path. > return "" > } else { > # Must be a \nnn octal value, then. > dec = esc * 64 + \ > substr(p, 1, 1) * 8 + \ > substr(p, 2, 1) > out = out sprintf("%c", dec) > p = substr(p, 3) > } > } > # Drop closing double quote, if there is one. > # (There is not any if this is a directory, as it was > # already stripped with the trailing path components.) > if (substr(p, length(p), 1) == "\"") > out = out substr(p, 1, length(p) - 1) > else > out = out p > > return out > }' >} >__git_is_configured_remote () >{ > local remote; > for remote in $(__git_remotes); > do > if [ "$remote" = "$1" ]; then > return 0; > fi; > done; > return 1 >} >__git_list_merge_strategies () >{ > LANG=C LC_ALL=C git merge -s help 2>&1 | sed -n -e '/[Aa]vailable strategies are: /,/^$/{ > s/\.$// > s/.*:// > s/^[ ]*// > s/[ ]*$// > p > }' >} >__git_ls_files_helper () >{ > if [ "$2" == "--committable" ]; then > __git -C "$1" -c core.quotePath=false diff-index --name-only --relative HEAD -- "${3//\\/\\\\}*"; > else > __git -C "$1" -c core.quotePath=false ls-files --exclude-standard $2 -- "${3//\\/\\\\}*"; > fi >} >__git_main () >{ > local i c=1 command __git_dir __git_repo_path; > local __git_C_args C_args_count=0; > while [ $c -lt $cword ]; do > i="${words[c]}"; > case "$i" in > --git-dir=*) > __git_dir="${i#--git-dir=}" > ;; > --git-dir) > ((c++)); > __git_dir="${words[c]}" > ;; > --bare) > __git_dir="." > ;; > --help) > command="help"; > break > ;; > -c | --work-tree | --namespace) > ((c++)) > ;; > -C) > __git_C_args[C_args_count++]=-C; > ((c++)); > __git_C_args[C_args_count++]="${words[c]}" > ;; > -*) > > ;; > *) > command="$i"; > break > ;; > esac; > ((c++)); > done; > if [ -z "${command-}" ]; then > case "$prev" in > --git-dir | -C | --work-tree) > return > ;; > -c) > __git_complete_config_variable_name_and_value; > return > ;; > --namespace) > return > ;; > esac; > case "$cur" in > --*) > __gitcomp " > --paginate > --no-pager > --git-dir= > --bare > --version > --exec-path > --exec-path= > --html-path > --man-path > --info-path > --work-tree= > --namespace= > --no-replace-objects > --help > " > ;; > *) > if test -n "${GIT_TESTING_PORCELAIN_COMMAND_LIST-}"; then > __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"; > else > __gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)"; > fi > ;; > esac; > return; > fi; > __git_complete_command "$command" && return; > local expansion=$(__git_aliased_command "$command"); > if [ -n "$expansion" ]; then > words[1]=$expansion; > __git_complete_command "$expansion"; > fi >} >__git_match_ctag () >{ > awk -v pfx="${3-}" -v sfx="${4-}" " > /^${1//\//\\/}/ { print pfx \$1 sfx } > " "$2" >} >__git_pretty_aliases () >{ > __git_get_config_variables "pretty" >} >__git_ps1 () >{ > local exit=$?; > local pcmode=no; > local detached=no; > local ps1pc_start='\u@\h:\w '; > local ps1pc_end='\$ '; > local printf_format=' (%s)'; > case "$#" in > 2 | 3) > pcmode=yes; > ps1pc_start="$1"; > ps1pc_end="$2"; > printf_format="${3:-$printf_format}"; > PS1="$ps1pc_start$ps1pc_end" > ;; > 0 | 1) > printf_format="${1:-$printf_format}" > ;; > *) > return $exit > ;; > esac; > local ps1_expanded=yes; > [ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no; > [ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no; > local repo_info rev_parse_exit_code; > repo_info="$(git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD 2>/dev/null)"; > rev_parse_exit_code="$?"; > if [ -z "$repo_info" ]; then > return $exit; > fi; > local short_sha=""; > if [ "$rev_parse_exit_code" = "0" ]; then > short_sha="${repo_info##* >}"; > repo_info="${repo_info% >*}"; > fi; > local inside_worktree="${repo_info##* >}"; > repo_info="${repo_info% >*}"; > local bare_repo="${repo_info##* >}"; > repo_info="${repo_info% >*}"; > local inside_gitdir="${repo_info##* >}"; > local g="${repo_info% >*}"; > if [ "true" = "$inside_worktree" ] && [ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] && [ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] && git check-ignore -q .; then > return $exit; > fi; > local sparse=""; > if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] && [ -z "${GIT_PS1_OMITSPARSESTATE}" ] && [ "$(git config --bool core.sparseCheckout)" = "true" ]; then > sparse="|SPARSE"; > fi; > local r=""; > local b=""; > local step=""; > local total=""; > if [ -d "$g/rebase-merge" ]; then > __git_eread "$g/rebase-merge/head-name" b; > __git_eread "$g/rebase-merge/msgnum" step; > __git_eread "$g/rebase-merge/end" total; > r="|REBASE"; > else > if [ -d "$g/rebase-apply" ]; then > __git_eread "$g/rebase-apply/next" step; > __git_eread "$g/rebase-apply/last" total; > if [ -f "$g/rebase-apply/rebasing" ]; then > __git_eread "$g/rebase-apply/head-name" b; > r="|REBASE"; > else > if [ -f "$g/rebase-apply/applying" ]; then > r="|AM"; > else > r="|AM/REBASE"; > fi; > fi; > else > if [ -f "$g/MERGE_HEAD" ]; then > r="|MERGING"; > else > if __git_sequencer_status; then > :; > else > if [ -f "$g/BISECT_LOG" ]; then > r="|BISECTING"; > fi; > fi; > fi; > fi; > if [ -n "$b" ]; then > :; > else > if [ -h "$g/HEAD" ]; then > b="$(git symbolic-ref HEAD 2>/dev/null)"; > else > local head=""; > if ! __git_eread "$g/HEAD" head; then > return $exit; > fi; > b="${head#ref: }"; > if [ "$head" = "$b" ]; then > detached=yes; > b="$( > case "${GIT_PS1_DESCRIBE_STYLE-}" in > (contains) > git describe --contains HEAD ;; > (branch) > git describe --contains --all HEAD ;; > (tag) > git describe --tags HEAD ;; > (describe) > git describe HEAD ;; > (* | default) > git describe --tags --exact-match HEAD ;; > esac 2>/dev/null)" || b="$short_sha..."; > b="($b)"; > fi; > fi; > fi; > fi; > if [ -n "$step" ] && [ -n "$total" ]; then > r="$r $step/$total"; > fi; > local w=""; > local i=""; > local s=""; > local u=""; > local h=""; > local c=""; > local p=""; > if [ "true" = "$inside_gitdir" ]; then > if [ "true" = "$bare_repo" ]; then > c="BARE:"; > else > b="GIT_DIR!"; > fi; > else > if [ "true" = "$inside_worktree" ]; then > if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] && [ "$(git config --bool bash.showDirtyState)" != "false" ]; then > git diff --no-ext-diff --quiet || w="*"; > git diff --no-ext-diff --cached --quiet || i="+"; > if [ -z "$short_sha" ] && [ -z "$i" ]; then > i="#"; > fi; > fi; > if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] && git rev-parse --verify --quiet refs/stash > /dev/null; then > s="$"; > fi; > if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] && [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] && git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' > /dev/null 2> /dev/null; then > u="%${ZSH_VERSION+%}"; > fi; > if [ -n "${GIT_PS1_COMPRESSSPARSESTATE}" ] && [ "$(git config --bool core.sparseCheckout)" = "true" ]; then > h="?"; > fi; > if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then > __git_ps1_show_upstream; > fi; > fi; > fi; > local z="${GIT_PS1_STATESEPARATOR-" "}"; > if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then > if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then > __git_ps1_colorize_gitstring; > fi; > fi; > b=${b##refs/heads/}; > if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then > __git_ps1_branch_name=$b; > b="\${__git_ps1_branch_name}"; > fi; > local f="$h$w$i$s$u"; > local gitstring="$c$b${f:+$z$f}${sparse}$r$p"; > if [ $pcmode = yes ]; then > if [ "${__git_printf_supports_v-}" != yes ]; then > gitstring=$(printf -- "$printf_format" "$gitstring"); > else > printf -v gitstring -- "$printf_format" "$gitstring"; > fi; > PS1="$ps1pc_start$gitstring$ps1pc_end"; > else > printf -- "$printf_format" "$gitstring"; > fi; > return $exit >} >__git_ps1_colorize_gitstring () >{ > if [[ -n ${ZSH_VERSION-} ]]; then > local c_red='%F{red}'; > local c_green='%F{green}'; > local c_lblue='%F{blue}'; > local c_clear='%f'; > else > local c_red='\[\e[31m\]'; > local c_green='\[\e[32m\]'; > local c_lblue='\[\e[1;34m\]'; > local c_clear='\[\e[0m\]'; > fi; > local bad_color=$c_red; > local ok_color=$c_green; > local flags_color="$c_lblue"; > local branch_color=""; > if [ $detached = no ]; then > branch_color="$ok_color"; > else > branch_color="$bad_color"; > fi; > c="$branch_color$c"; > z="$c_clear$z"; > if [ "$w" = "*" ]; then > w="$bad_color$w"; > fi; > if [ -n "$i" ]; then > i="$ok_color$i"; > fi; > if [ -n "$s" ]; then > s="$flags_color$s"; > fi; > if [ -n "$u" ]; then > u="$bad_color$u"; > fi; > r="$c_clear$r" >} >__git_ps1_show_upstream () >{ > local key value; > local svn_remote svn_url_pattern count n; > local upstream=git legacy="" verbose="" name=""; > svn_remote=(); > local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"; > while read -r key value; do > case "$key" in > bash.showupstream) > GIT_PS1_SHOWUPSTREAM="$value"; > if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then > p=""; > return; > fi > ;; > svn-remote.*.url) > svn_remote[$((${#svn_remote[@]} + 1))]="$value"; > svn_url_pattern="$svn_url_pattern\\|$value"; > upstream=svn+git > ;; > esac; > done <<< "$output"; > local option; > for option in ${GIT_PS1_SHOWUPSTREAM}; > do > case "$option" in > git | svn) > upstream="$option" > ;; > verbose) > verbose=1 > ;; > legacy) > legacy=1 > ;; > name) > name=1 > ;; > esac; > done; > case "$upstream" in > git) > upstream="@{upstream}" > ;; > svn*) > local -a svn_upstream; > svn_upstream=($(git log --first-parent -1 --grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null)); > if [[ 0 -ne ${#svn_upstream[@]} ]]; then > svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]}; > svn_upstream=${svn_upstream%@*}; > local n_stop="${#svn_remote[@]}"; > for ((n=1; n <= n_stop; n++)) > do > svn_upstream=${svn_upstream#${svn_remote[$n]}}; > done; > if [[ -z "$svn_upstream" ]]; then > upstream=${GIT_SVN_ID:-git-svn}; > else > upstream=${svn_upstream#/}; > fi; > else > if [[ "svn+git" = "$upstream" ]]; then > upstream="@{upstream}"; > fi; > fi > ;; > esac; > if [[ -z "$legacy" ]]; then > count="$(git rev-list --count --left-right "$upstream"...HEAD 2>/dev/null)"; > else > local commits; > if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"; then > local commit behind=0 ahead=0; > for commit in $commits; > do > case "$commit" in > "<"*) > ((behind++)) > ;; > *) > ((ahead++)) > ;; > esac; > done; > count="$behind $ahead"; > else > count=""; > fi; > fi; > if [[ -z "$verbose" ]]; then > case "$count" in > "") > p="" > ;; > "0 0") > p="=" > ;; > "0 "*) > p=">" > ;; > *" 0") > p="<" > ;; > *) > p="<>" > ;; > esac; > else > case "$count" in > "") > p="" > ;; > "0 0") > p=" u=" > ;; > "0 "*) > p=" u+${count#0 }" > ;; > *" 0") > p=" u-${count% 0}" > ;; > *) > p=" u+${count#* }-${count% *}" > ;; > esac; > if [[ -n "$count" && -n "$name" ]]; then > __git_ps1_upstream_name=$(git rev-parse --abbrev-ref "$upstream" 2>/dev/null); > if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then > p="$p \${__git_ps1_upstream_name}"; > else > p="$p ${__git_ps1_upstream_name}"; > unset __git_ps1_upstream_name; > fi; > fi; > fi >} >__git_reassemble_comp_words_by_ref () >{ > local exclude i j first; > exclude="${1//[^$COMP_WORDBREAKS]}"; > cword_=$COMP_CWORD; > if [ -z "$exclude" ]; then > words_=("${COMP_WORDS[@]}"); > return; > fi; > for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)) > do > first=t; > while [ $i -gt 0 ] && [ -n "${COMP_WORDS[$i]}" ] && [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ]; do > if [ $j -ge 2 ] && [ -n "$first" ]; then > ((j--)); > fi; > first=; > words_[$j]=${words_[j]}${COMP_WORDS[i]}; > if [ $i = $COMP_CWORD ]; then > cword_=$j; > fi; > if (($i < ${#COMP_WORDS[@]} - 1)); then > ((i++)); > else > return; > fi; > done; > words_[$j]=${words_[j]}${COMP_WORDS[i]}; > if [ $i = $COMP_CWORD ]; then > cword_=$j; > fi; > done >} >__git_refs () >{ > local i hash dir track="${2-}"; > local list_refs_from=path remote="${1-}"; > local format refs; > local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"; > local match="${4-}"; > local fer_pfx="${pfx//\%/%%}"; > __git_find_repo_path; > dir="$__git_repo_path"; > if [ -z "$remote" ]; then > if [ -z "$dir" ]; then > return; > fi; > else > if __git_is_configured_remote "$remote"; then > list_refs_from=remote; > else > if [ -d "$remote/.git" ]; then > dir="$remote/.git"; > else > if [ -d "$remote" ]; then > dir="$remote"; > else > list_refs_from=url; > fi; > fi; > fi; > fi; > if [ "$list_refs_from" = path ]; then > if [[ "$cur_" == ^* ]]; then > pfx="$pfx^"; > fer_pfx="$fer_pfx^"; > cur_=${cur_#^}; > match=${match#^}; > fi; > case "$cur_" in > refs | refs/*) > format="refname"; > refs=("$match*" "$match*/**"); > track="" > ;; > *) > for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD; > do > case "$i" in > $match*) > if [ -e "$dir/$i" ]; then > echo "$pfx$i$sfx"; > fi > ;; > esac; > done; > format="refname:strip=2"; > refs=("refs/tags/$match*" "refs/tags/$match*/**" "refs/heads/$match*" "refs/heads/$match*/**" "refs/remotes/$match*" "refs/remotes/$match*/**") > ;; > esac; > __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" "${refs[@]}"; > if [ -n "$track" ]; then > __git_dwim_remote_heads "$pfx" "$match" "$sfx"; > fi; > return; > fi; > case "$cur_" in > refs | refs/*) > __git ls-remote "$remote" "$match*" | while read -r hash i; do > case "$i" in > *^{}) > > ;; > *) > echo "$pfx$i$sfx" > ;; > esac; > done > ;; > *) > if [ "$list_refs_from" = remote ]; then > case "HEAD" in > $match*) > echo "${pfx}HEAD$sfx" > ;; > esac; > __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" "refs/remotes/$remote/$match*" "refs/remotes/$remote/$match*/**"; > else > local query_symref; > case "HEAD" in > $match*) > query_symref="HEAD" > ;; > esac; > __git ls-remote "$remote" $query_symref "refs/tags/$match*" "refs/heads/$match*" "refs/remotes/$match*" | while read -r hash i; do > case "$i" in > *^{}) > > ;; > refs/*) > echo "$pfx${i#refs/*/}$sfx" > ;; > *) > echo "$pfx$i$sfx" > ;; > esac; > done; > fi > ;; > esac >} >__git_refs2 () >{ > local i; > for i in $(__git_refs "$1"); > do > echo "$i:$i"; > done >} >__git_refs_remotes () >{ > local i hash; > __git ls-remote "$1" 'refs/heads/*' | while read -r hash i; do > echo "$i:refs/remotes/$1/${i#refs/heads/}"; > done >} >__git_remote_heads () >{ > local pfx="${1-}" cur_="${2-}" sfx="${3-}"; > __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" "refs/remotes/$cur_*" "refs/remotes/$cur_*/**" >} >__git_remotes () >{ > __git_find_repo_path; > test -d "$__git_repo_path/remotes" && ls -1 "$__git_repo_path/remotes"; > __git remote >} >__git_sequencer_status () >{ > local todo; > if test -f "$g/CHERRY_PICK_HEAD"; then > r="|CHERRY-PICKING"; > return 0; > else > if test -f "$g/REVERT_HEAD"; then > r="|REVERTING"; > return 0; > else > if __git_eread "$g/sequencer/todo" todo; then > case "$todo" in > p[\ \ ] | pick[\ \ ]*) > r="|CHERRY-PICKING"; > return 0 > ;; > revert[\ \ ]*) > r="|REVERTING"; > return 0 > ;; > esac; > fi; > fi; > fi; > return 1 >} >__git_support_parseopt_helper () >{ > test -n "$__git_cmds_with_parseopt_helper" || __git_cmds_with_parseopt_helper="$(__git --list-cmds=parseopt)"; > case " $__git_cmds_with_parseopt_helper " in > *" $1 "*) > return 0 > ;; > *) > return 1 > ;; > esac >} >__git_tags () >{ > local pfx="${1-}" cur_="${2-}" sfx="${3-}"; > __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" "refs/tags/$cur_*" "refs/tags/$cur_*/**" >} >__git_wrap__git_main () >{ > __git_func_wrap __git_main >} >__git_wrap__gitk_main () >{ > __git_func_wrap __gitk_main >} >__gitcomp () >{ > local cur_="${3-$cur}"; > case "$cur_" in > --*=) > > ;; > --no-*) > local c i=0 IFS=' >'; > for c in $1; > do > if [[ $c == "--" ]]; then > continue; > fi; > c="$c${4-}"; > if [[ $c == "$cur_"* ]]; then > case $c in > --*= | *.) > > ;; > *) > c="$c " > ;; > esac; > COMPREPLY[i++]="${2-}$c"; > fi; > done > ;; > *) > local c i=0 IFS=' >'; > for c in $1; > do > if [[ $c == "--" ]]; then > c="--no-...${4-}"; > if [[ $c == "$cur_"* ]]; then > COMPREPLY[i++]="${2-}$c "; > fi; > break; > fi; > c="$c${4-}"; > if [[ $c == "$cur_"* ]]; then > case $c in > *= | *.) > > ;; > *) > c="$c " > ;; > esac; > COMPREPLY[i++]="${2-}$c"; > fi; > done > ;; > esac >} >__gitcomp_builtin () >{ > local cmd="$1"; > local incl="${2-}"; > local excl="${3-}"; > local var=__gitcomp_builtin_"${cmd/-/_}"; > local options; > eval "options=\${$var-}"; > if [ -z "$options" ]; then > local completion_helper; > if [ "$GIT_COMPLETION_SHOW_ALL" = "1" ]; then > completion_helper="--git-completion-helper-all"; > else > completion_helper="--git-completion-helper"; > fi; > options=" $incl $(__git ${cmd/_/ } $completion_helper) " || return; > for i in $excl; > do > options="${options/ $i / }"; > done; > eval "$var=\"$options\""; > fi; > __gitcomp "$options" >} >__gitcomp_direct () >{ > local IFS=' >'; > COMPREPLY=($1) >} >__gitcomp_direct_append () >{ > local IFS=' >'; > COMPREPLY+=($1) >} >__gitcomp_file () >{ > local IFS=' >'; > __gitcompadd "$1" "${2-}" "${3-$cur}" ""; > compopt -o filenames +o nospace 2> /dev/null || compgen -f /non-existing-dir/ > /dev/null || true >} >__gitcomp_file_direct () >{ > local IFS=' >'; > COMPREPLY=($1); > compopt -o filenames +o nospace 2> /dev/null || compgen -f /non-existing-dir/ > /dev/null || true >} >__gitcomp_nl () >{ > COMPREPLY=(); > __gitcomp_nl_append "$@" >} >__gitcomp_nl_append () >{ > local IFS=' >'; > __gitcompappend "$1" "${2-}" "${3-$cur}" "${4- }" >} >__gitcompadd () >{ > COMPREPLY=(); > __gitcompappend "$@" >} >__gitcompappend () >{ > local x i=${#COMPREPLY[@]}; > for x in $1; > do > if [[ "$x" == "$3"* ]]; then > COMPREPLY[i++]="$2$x$4"; > fi; > done >} >__gitdir () >{ > if [ -z "${1-}" ]; then > __git_find_repo_path || return 1; > echo "$__git_repo_path"; > else > if [ -d "$1/.git" ]; then > echo "$1/.git"; > else > echo "$1"; > fi; > fi >} >__gitk_main () >{ > __git_has_doubledash && return; > local __git_repo_path; > __git_find_repo_path; > local merge=""; > if [ -f "$__git_repo_path/MERGE_HEAD" ]; then > merge="--merge"; > fi; > case "$cur" in > --*) > __gitcomp " > $__git_log_common_options > $__git_log_gitk_options > $merge > "; > return > ;; > esac; > __git_complete_revlist >} >__ibus () >{ > COMPREPLY=(); > local cur_=$2 prev_=$3 cur words cword prev; > _get_comp_words_by_ref -n =: cur words cword prev; > local cmds=(engine list-engine watch restart exit); > local i c cmd subcmd; > for ((i=1; i < ${#words[@]}-1; i++)) > do > [[ -n $cmd ]] && subcmd=${words[i]} && break; > for c in ${cmds[@]}; > do > [[ ${words[i]} == $c ]] && cmd=$c && break; > done; > done; > case $cmd in > engine) > __ibus_engine; > return 0 > ;; > list-engine) > __ibus_list_engine; > return 0 > ;; > watch) > return 0 > ;; > *) > COMPREPLY=($( compgen -W '${cmds[@]}' -- "$cur" )); > return 0 > ;; > esac >} >__ibus_engine () >{ > if [[ "$cmd" == "$prev" ]]; then > local imes=$( ibus list-engine --name-only 2>/dev/null ); > COMPREPLY=($( compgen -W "$imes" -- "$cur" | sed "s/^$cur/$cur_/" )); > fi >} >__ibus_list_engine () >{ > if [[ "$cur" == -* ]]; then > local options=(--name-only); > COMPREPLY=($( compgen -W '${options[@]}' -- "$cur" )); > fi >} >__load_completion () >{ > local -a dirs=(${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions); > local ifs=$IFS IFS=: dir cmd="${1##*/}" compfile; > [[ -n $cmd ]] || return 1; > for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; > do > dirs+=($dir/bash-completion/completions); > done; > IFS=$ifs; > if [[ $BASH_SOURCE == */* ]]; then > dirs+=("${BASH_SOURCE%/*}/completions"); > else > dirs+=(./completions); > fi; > local backslash=; > if [[ $cmd == \\* ]]; then > cmd="${cmd:1}"; > $(complete -p "$cmd" 2>/dev/null || echo false) "\\$cmd" && return 0; > backslash=\\; > fi; > for dir in "${dirs[@]}"; > do > [[ -d $dir ]] || continue; > for compfile in "$cmd" "$cmd.bash" "_$cmd"; > do > compfile="$dir/$compfile"; > if [[ -f $compfile ]] && . "$compfile" &> /dev/null; then > [[ -n $backslash ]] && $(complete -p "$cmd") "\\$cmd"; > return 0; > fi; > done; > done; > [[ -v _xspecs[$cmd] ]] && complete -F _filedir_xspec "$cmd" "$backslash$cmd" && return 0; > return 1 >} >__ltrim_colon_completions () >{ > if [[ $1 == *:* && $COMP_WORDBREAKS == *:* ]]; then > local colon_word=${1%"${1##*:}"}; > local i=${#COMPREPLY[*]}; > while ((i-- > 0)); do > COMPREPLY[i]=${COMPREPLY[i]#"$colon_word"}; > done; > fi >} >__parse_options () >{ > local option option2 i IFS=' >,/|'; > option=; > local -a array=($1); > for i in "${array[@]}"; > do > case "$i" in > ---*) > break > ;; > --?*) > option=$i; > break > ;; > -?*) > [[ -n $option ]] || option=$i > ;; > *) > break > ;; > esac; > done; > [[ -n $option ]] || return 0; > IFS=' >'; > if [[ $option =~ (\[((no|dont)-?)\]). ]]; then > option2=${option/"${BASH_REMATCH[1]}"/}; > option2=${option2%%[<{().[]*}; > printf '%s\n' "${option2/=*/=}"; > option=${option/"${BASH_REMATCH[1]}"/"${BASH_REMATCH[2]}"}; > fi; > option=${option%%[<{().[]*}; > printf '%s\n' "${option/=*/=}" >} >__reassemble_comp_words_by_ref () >{ > local exclude i j line ref; > if [[ -n $1 ]]; then > exclude="[${1//[^$COMP_WORDBREAKS]/}]"; > fi; > printf -v "$3" %s "$COMP_CWORD"; > if [[ -v exclude ]]; then > line=$COMP_LINE; > for ((i = 0, j = 0; i < ${#COMP_WORDS[@]}; i++, j++)) > do > while [[ $i -gt 0 && ${COMP_WORDS[i]} == +($exclude) ]]; do > [[ $line != [[:blank:]]* ]] && ((j >= 2)) && ((j--)); > ref="$2[$j]"; > printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}"; > ((i == COMP_CWORD)) && printf -v "$3" %s "$j"; > line=${line#*"${COMP_WORDS[i]}"}; > [[ $line == [[:blank:]]* ]] && ((j++)); > ((i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2; > done; > ref="$2[$j]"; > printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}"; > line=${line#*"${COMP_WORDS[i]}"}; > ((i == COMP_CWORD)) && printf -v "$3" %s "$j"; > done; > ((i == COMP_CWORD)) && printf -v "$3" %s "$j"; > else > for i in "${!COMP_WORDS[@]}"; > do > printf -v "$2[i]" %s "${COMP_WORDS[i]}"; > done; > fi >} >_allowed_groups () >{ > if _complete_as_root; then > local IFS=' >'; > COMPREPLY=($(compgen -g -- "$1")); > else > local IFS=' > '; > COMPREPLY=($(compgen -W "$(id -Gn 2>/dev/null || groups 2>/dev/null)" -- "$1")); > fi >} >_allowed_users () >{ > if _complete_as_root; then > local IFS=' >'; > COMPREPLY=($(compgen -u -- "${1:-$cur}")); > else > local IFS=' > '; > COMPREPLY=($(compgen -W "$(id -un 2>/dev/null || whoami 2>/dev/null)" -- "${1:-$cur}")); > fi >} >_available_interfaces () >{ > local PATH=$PATH:/sbin; > COMPREPLY=($({ > if [[ ${1:-} == -w ]]; then > iwconfig > elif [[ ${1:-} == -a ]]; then > ifconfig || ip link show up > else > ifconfig -a || ip link show > fi > } 2>/dev/null | awk '/^[^ \t]/ { if ($1 ~ /^[0-9]+:/) { print $2 } else { print $1 } }')); > COMPREPLY=($(compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur")) >} >_bashcomp_try_faketty () >{ > if type unbuffer &> /dev/null; then > unbuffer -p "$@"; > else > if script --version 2>&1 | command grep -qF util-linux; then > script -qaefc "$*" /dev/null; > else > "$@"; > fi; > fi >} >_cd () >{ > local cur prev words cword; > _init_completion || return; > local IFS=' >' i j k; > compopt -o filenames; > if [[ -z ${CDPATH:-} || $cur == ?(.)?(.)/* ]]; then > _filedir -d; > return; > fi; > local -r mark_dirs=$(_rl_enabled mark-directories && echo y); > local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y); > for i in ${CDPATH//:/' >'}; > do > k="${#COMPREPLY[@]}"; > for j in $(compgen -d -- $i/$cur); > do > if [[ ( -n $mark_symdirs && -L $j || -n $mark_dirs && ! -L $j ) && ! -d ${j#$i/} ]]; then > j+="/"; > fi; > COMPREPLY[k++]=${j#$i/}; > done; > done; > _filedir -d; > if ((${#COMPREPLY[@]} == 1)); then > i=${COMPREPLY[0]}; > if [[ $i == "$cur" && $i != "*/" ]]; then > COMPREPLY[0]="${i}/"; > fi; > fi; > return >} >_cd_devices () >{ > COMPREPLY+=($(compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}")) >} >_command () >{ > local offset i; > offset=1; > for ((i = 1; i <= COMP_CWORD; i++)) > do > if [[ ${COMP_WORDS[i]} != -* ]]; then > offset=$i; > break; > fi; > done; > _command_offset $offset >} >_command_offset () >{ > local word_offset=$1 i j; > for ((i = 0; i < word_offset; i++)) > do > for ((j = 0; j <= ${#COMP_LINE}; j++)) > do > [[ $COMP_LINE == "${COMP_WORDS[i]}"* ]] && break; > COMP_LINE=${COMP_LINE:1}; > ((COMP_POINT--)); > done; > COMP_LINE=${COMP_LINE#"${COMP_WORDS[i]}"}; > ((COMP_POINT -= ${#COMP_WORDS[i]})); > done; > for ((i = 0; i <= COMP_CWORD - word_offset; i++)) > do > COMP_WORDS[i]=${COMP_WORDS[i + word_offset]}; > done; > for ((i; i <= COMP_CWORD; i++)) > do > unset 'COMP_WORDS[i]'; > done; > ((COMP_CWORD -= word_offset)); > COMPREPLY=(); > local cur; > _get_comp_words_by_ref cur; > if ((COMP_CWORD == 0)); then > local IFS=' >'; > compopt -o filenames; > COMPREPLY=($(compgen -d -c -- "$cur")); > else > local cmd=${COMP_WORDS[0]} compcmd=${COMP_WORDS[0]}; > local cspec=$(complete -p $cmd 2>/dev/null); > if [[ ! -n $cspec && $cmd == */* ]]; then > cspec=$(complete -p ${cmd##*/} 2>/dev/null); > [[ -n $cspec ]] && compcmd=${cmd##*/}; > fi; > if [[ ! -n $cspec ]]; then > compcmd=${cmd##*/}; > _completion_loader $compcmd; > cspec=$(complete -p $compcmd 2>/dev/null); > fi; > if [[ -n $cspec ]]; then > if [[ ${cspec#* -F } != "$cspec" ]]; then > local func=${cspec#*-F }; > func=${func%% *}; > if ((${#COMP_WORDS[@]} >= 2)); then > $func $cmd "${COMP_WORDS[-1]}" "${COMP_WORDS[-2]}"; > else > $func $cmd "${COMP_WORDS[-1]}"; > fi; > local opt; > while [[ $cspec == *" -o "* ]]; do > cspec=${cspec#*-o }; > opt=${cspec%% *}; > compopt -o $opt; > cspec=${cspec#$opt}; > done; > else > cspec=${cspec#complete}; > cspec=${cspec%%$compcmd}; > COMPREPLY=($(eval compgen "$cspec" -- '$cur')); > fi; > else > if ((${#COMPREPLY[@]} == 0)); then > _minimal; > fi; > fi; > fi >} >_complete_as_root () >{ > [[ $EUID -eq 0 || -n ${root_command:-} ]] >} >_completion_loader () >{ > local cmd="${1:-_EmptycmD_}"; > __load_completion "$cmd" && return 124; > complete -F _minimal -- "$cmd" && return 124 >} >_configured_interfaces () >{ > if [[ -f /etc/debian_version ]]; then > COMPREPLY=($(compgen -W "$(command sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p' /etc/network/interfaces /etc/network/interfaces.d/* 2>/dev/null)" -- "$cur")); > else > if [[ -f /etc/SuSE-release ]]; then > COMPREPLY=($(compgen -W "$(printf '%s\n' /etc/sysconfig/network/ifcfg-* | > command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur")); > else > if [[ -f /etc/pld-release ]]; then > COMPREPLY=($(compgen -W "$(command ls -B /etc/sysconfig/interfaces | > command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur")); > else > COMPREPLY=($(compgen -W "$(printf '%s\n' /etc/sysconfig/network-scripts/ifcfg-* | > command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur")); > fi; > fi; > fi >} >_count_args () >{ > local i cword words; > __reassemble_comp_words_by_ref "${1-}" words cword; > args=1; > for ((i = 1; i < cword; i++)) > do > if [[ ${words[i]} != -* && ${words[i - 1]} != ${2-} || ${words[i]} == ${3-} ]]; then > ((args++)); > fi; > done >} >_django_completion () >{ > COMPREPLY=($( COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD DJANGO_AUTO_COMPLETE=1 $1 )) >} >_dkms () >{ > local cur prev command module i; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > if [[ $COMP_CWORD -eq 1 ]]; then > COMPREPLY=($( compgen -W "add remove build install uninstall match mkdriverdisk mktarball ldtarball mkrpm mkdeb mkkmp status" -- $cur )); > else > prev=${COMP_WORDS[COMP_CWORD-1]}; > command=${COMP_WORDS[1]}; > case $prev in > -m) > if [ "$command" = 'add' ]; then > _filename_parts '.*-.*' 1; > else > _subdirectories /var/lib/dkms; > fi; > return 0 > ;; > -v) > for ((i=1; i < COMP_CWORD; i++ )) > do > if [[ "${COMP_WORDS[i]}" == -m ]]; then > module=${COMP_WORDS[i+1]}; > break; > fi; > done; > if [ -n "$module" ]; then > if [ "$command" = 'add' ]; then > _filename_parts "$module-.*" 2; > else > _subdirectories /var/lib/dkms/$module; > fi; > return 0; > fi > ;; > -k) > _kernels; > return 0 > ;; > -@\(c | -spec | -archive | -config\)) > _filedir; > return 0 > ;; > --kernelsourcedir) > _filedir -d; > return 0 > ;; > esac; > if [[ "$cur" == -* ]]; then > case $command in > add) > options='-c --rpm_safe_upgrade' > ;; > remove) > options='--rpm_safe_upgrade' > ;; > build) > options='--config' > ;; > mkdriverdisk) > options='-d --distro -r --release --size' > ;; > ldtarball) > options='--archive --force' > ;; > mktarball) > options='--source-only --binaries-only' > ;; > mkrpm) > options='--source-only' > ;; > mkkmp) > options='--spec' > ;; > match) > options='--templatekernel' > ;; > esac; > options="$options -m -v -k -a --arch -q --quiet -V --version --all --no-prepare-kernel --no-clean-kernel --kernelsourcedir --directive"; > COMPREPLY=($( compgen -W "$options" -- $cur )); > fi; > fi >} >_dvd_devices () >{ > COMPREPLY+=($(compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}")) >} >_expand () >{ > case ${cur-} in > ~*/*) > __expand_tilde_by_ref cur > ;; > ~*) > _tilde "$cur" || eval COMPREPLY[0]="$(printf ~%q "${COMPREPLY[0]#\~}")"; > return ${#COMPREPLY[@]} > ;; > esac >} >_filedir () >{ > local IFS=' >'; > _tilde "${cur-}" || return; > local -a toks; > local reset arg=${1-}; > if [[ $arg == -d ]]; then > reset=$(shopt -po noglob); > set -o noglob; > toks=($(compgen -d -- "${cur-}")); > IFS=' '; > $reset; > IFS=' >'; > else > local quoted; > _quote_readline_by_ref "${cur-}" quoted; > local xspec=${arg:+"!*.@($arg|${arg^^})"} plusdirs=(); > local opts=(-f -X "$xspec"); > [[ -n $xspec ]] && plusdirs=(-o plusdirs); > [[ -n ${COMP_FILEDIR_FALLBACK-} || -z ${plusdirs-} ]] || opts+=("${plusdirs[@]}"); > reset=$(shopt -po noglob); > set -o noglob; > toks+=($(compgen "${opts[@]}" -- $quoted)); > IFS=' '; > $reset; > IFS=' >'; > [[ -n ${COMP_FILEDIR_FALLBACK-} && -n $arg && ${#toks[@]} -lt 1 ]] && { > reset=$(shopt -po noglob); > set -o noglob; > toks+=($(compgen -f ${plusdirs+"${plusdirs[@]}"} -- $quoted)); > IFS=' '; > $reset; > IFS=' >' > }; > fi; > if ((${#toks[@]} != 0)); then > compopt -o filenames 2> /dev/null; > COMPREPLY+=("${toks[@]}"); > fi >} >_filedir_xspec () >{ > local cur prev words cword; > _init_completion || return; > _tilde "$cur" || return; > local IFS=' >' xspec=${_xspecs[${1##*/}]} tmp; > local -a toks; > toks=($( > compgen -d -- "$(quote_readline "$cur")" | { > while read -r tmp; do > printf '%s\n' $tmp > done > } > )); > eval xspec="${xspec}"; > local matchop=!; > if [[ $xspec == !* ]]; then > xspec=${xspec#!}; > matchop=@; > fi; > xspec="$matchop($xspec|${xspec^^})"; > toks+=($( > eval compgen -f -X "'!$xspec'" -- '$(quote_readline "$cur")' | { > while read -r tmp; do > [[ -n $tmp ]] && printf '%s\n' $tmp > done > } > )); > [[ -n ${COMP_FILEDIR_FALLBACK:-} && ${#toks[@]} -lt 1 ]] && { > local reset=$(shopt -po noglob); > set -o noglob; > toks+=($(compgen -f -- "$(quote_readline "$cur")")); > IFS=' '; > $reset; > IFS=' >' > }; > if ((${#toks[@]} != 0)); then > compopt -o filenames; > COMPREPLY=("${toks[@]}"); > fi >} >_filename_parts () >{ > COMPREPLY=($( command ls -F /usr/src 2>/dev/null | grep -E '^'$1'/$' | sed -r -e 's/^([^-]+)-(.+)\/$/\'$2'/' | grep "^$cur" )) >} >_fstypes () >{ > local fss; > if [[ -e /proc/filesystems ]]; then > fss="$(cut -d' ' -f2 /proc/filesystems) > $(awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null)"; > else > fss="$(awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null) > $(awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null) > $(awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null) > $(awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null) > $([[ -d /etc/fs ]] && command ls /etc/fs)"; > fi; > [[ -n $fss ]] && COMPREPLY+=($(compgen -W "$fss" -- "$cur")) >} >_get_comp_words_by_ref () >{ > local exclude flag i OPTIND=1; > local cur cword words=(); > local upargs=() upvars=() vcur vcword vprev vwords; > while getopts "c:i:n:p:w:" flag "$@"; do > case $flag in > c) > vcur=$OPTARG > ;; > i) > vcword=$OPTARG > ;; > n) > exclude=$OPTARG > ;; > p) > vprev=$OPTARG > ;; > w) > vwords=$OPTARG > ;; > *) > echo "bash_completion: $FUNCNAME: usage error" 1>&2; > return 1 > ;; > esac; > done; > while [[ $# -ge $OPTIND ]]; do > case ${!OPTIND} in > cur) > vcur=cur > ;; > prev) > vprev=prev > ;; > cword) > vcword=cword > ;; > words) > vwords=words > ;; > *) > echo "bash_completion: $FUNCNAME: \`${!OPTIND}':" "unknown argument" 1>&2; > return 1 > ;; > esac; > ((OPTIND += 1)); > done; > __get_cword_at_cursor_by_ref "${exclude-}" words cword cur; > [[ -v vcur ]] && { > upvars+=("$vcur"); > upargs+=(-v $vcur "$cur") > }; > [[ -v vcword ]] && { > upvars+=("$vcword"); > upargs+=(-v $vcword "$cword") > }; > [[ -v vprev && $cword -ge 1 ]] && { > upvars+=("$vprev"); > upargs+=(-v $vprev "${words[cword - 1]}") > }; > [[ -v vwords ]] && { > upvars+=("$vwords"); > upargs+=(-a${#words[@]} $vwords ${words+"${words[@]}"}) > }; > ((${#upvars[@]})) && local "${upvars[@]}" && _upvars "${upargs[@]}" >} >_get_cword () >{ > local LC_CTYPE=C; > local cword words; > __reassemble_comp_words_by_ref "${1-}" words cword; > if [[ -n ${2-} && -n ${2//[^0-9]/} ]]; then > printf "%s" "${words[cword - $2]}"; > else > if ((${#words[cword]} == 0 && COMP_POINT == ${#COMP_LINE})); then > :; > else > local i; > local cur="$COMP_LINE"; > local index="$COMP_POINT"; > for ((i = 0; i <= cword; ++i)) > do > while [[ ${#cur} -ge ${#words[i]} && ${cur:0:${#words[i]}} != "${words[i]}" ]]; do > cur="${cur:1}"; > ((index > 0)) && ((index--)); > done; > if ((i < cword)); then > local old_size="${#cur}"; > cur="${cur#${words[i]}}"; > local new_size="${#cur}"; > ((index -= old_size - new_size)); > fi; > done; > if [[ ${words[cword]:0:${#cur}} != "$cur" ]]; then > printf "%s" "${words[cword]}"; > else > printf "%s" "${cur:0:index}"; > fi; > fi; > fi >} >_get_first_arg () >{ > local i; > arg=; > for ((i = 1; i < COMP_CWORD; i++)) > do > if [[ ${COMP_WORDS[i]} != -* ]]; then > arg=${COMP_WORDS[i]}; > break; > fi; > done >} >_get_pword () >{ > if ((COMP_CWORD >= 1)); then > _get_cword "${@:-}" 1; > fi >} >_gids () >{ > if type getent &> /dev/null; then > COMPREPLY=($(compgen -W '$(getent group | cut -d: -f3)' -- "$cur")); > else > if type perl &> /dev/null; then > COMPREPLY=($(compgen -W '$(perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"')' -- "$cur")); > else > COMPREPLY=($(compgen -W '$(cut -d: -f3 /etc/group)' -- "$cur")); > fi; > fi >} >_git_add () >{ > case "$cur" in > --chmod=*) > __gitcomp "+x -x" "" "${cur##--chmod=}"; > return > ;; > --*) > __gitcomp_builtin add; > return > ;; > esac; > local complete_opt="--others --modified --directory --no-empty-directory"; > if test -n "$(__git_find_on_cmdline "-u --update")"; then > complete_opt="--modified"; > fi; > __git_complete_index_file "$complete_opt" >} >_git_am () >{ > __git_find_repo_path; > if [ -d "$__git_repo_path"/rebase-apply ]; then > __gitcomp "$__git_am_inprogress_options"; > return; > fi; > case "$cur" in > --whitespace=*) > __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"; > return > ;; > --patch-format=*) > __gitcomp "$__git_patchformat" "" "${cur##--patch-format=}"; > return > ;; > --show-current-patch=*) > __gitcomp "$__git_showcurrentpatch" "" "${cur##--show-current-patch=}"; > return > ;; > --*) > __gitcomp_builtin am "" "$__git_am_inprogress_options"; > return > ;; > esac >} >_git_apply () >{ > case "$cur" in > --whitespace=*) > __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"; > return > ;; > --*) > __gitcomp_builtin apply; > return > ;; > esac >} >_git_archive () >{ > case "$cur" in > --format=*) > __gitcomp "$(git archive --list)" "" "${cur##--format=}"; > return > ;; > --remote=*) > __gitcomp_nl "$(__git_remotes)" "" "${cur##--remote=}"; > return > ;; > --*) > __gitcomp_builtin archive "--format= --list --verbose --prefix= --worktree-attributes"; > return > ;; > esac; > __git_complete_file >} >_git_bisect () >{ > __git_has_doubledash && return; > local subcommands="start bad good skip reset visualize replay log run"; > local subcommand="$(__git_find_on_cmdline "$subcommands")"; > if [ -z "$subcommand" ]; then > __git_find_repo_path; > if [ -f "$__git_repo_path"/BISECT_START ]; then > __gitcomp "$subcommands"; > else > __gitcomp "replay start"; > fi; > return; > fi; > case "$subcommand" in > bad | good | reset | skip | start) > __git_complete_refs > ;; > *) > > ;; > esac >} >_git_branch () >{ > local i c=1 only_local_ref="n" has_r="n"; > while [ $c -lt $cword ]; do > i="${words[c]}"; > case "$i" in > -d | --delete | -m | --move) > only_local_ref="y" > ;; > -r | --remotes) > has_r="y" > ;; > esac; > ((c++)); > done; > case "$cur" in > --set-upstream-to=*) > __git_complete_refs --cur="${cur##--set-upstream-to=}" > ;; > --*) > __gitcomp_builtin branch > ;; > *) > if [ $only_local_ref = "y" -a $has_r = "n" ]; then > __gitcomp_direct "$(__git_heads "" "$cur" " ")"; > else > __git_complete_refs; > fi > ;; > esac >} >_git_bundle () >{ > local cmd="${words[2]}"; > case "$cword" in > 2) > __gitcomp "create list-heads verify unbundle" > ;; > 3) > > ;; > *) > case "$cmd" in > create) > __git_complete_revlist > ;; > esac > ;; > esac >} >_git_checkout () >{ > __git_has_doubledash && return; > local dwim_opt="$(__git_checkout_default_dwim_mode)"; > case "$prev" in > -b | -B | --orphan) > __git_complete_refs $dwim_opt --mode="heads"; > return > ;; > *) > > ;; > esac; > case "$cur" in > --conflict=*) > __gitcomp "diff3 merge" "" "${cur##--conflict=}" > ;; > --*) > __gitcomp_builtin checkout > ;; > *) > if [ -n "$(__git_find_on_cmdline "-b -B -d --detach --orphan")" ]; then > __git_complete_refs --mode="refs"; > else > if [ -n "$(__git_find_on_cmdline "--track")" ]; then > __git_complete_refs --mode="remote-heads"; > else > __git_complete_refs $dwim_opt --mode="refs"; > fi; > fi > ;; > esac >} >_git_cherry_pick () >{ > __git_find_repo_path; > if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then > __gitcomp "$__git_cherry_pick_inprogress_options"; > return; > fi; > __git_complete_strategy && return; > case "$cur" in > --*) > __gitcomp_builtin cherry-pick "" "$__git_cherry_pick_inprogress_options" > ;; > *) > __git_complete_refs > ;; > esac >} >_git_clean () >{ > case "$cur" in > --*) > __gitcomp_builtin clean; > return > ;; > esac; > __git_complete_index_file "--others --directory" >} >_git_clone () >{ > case "$prev" in > -c | --config) > __git_complete_config_variable_name_and_value; > return > ;; > esac; > case "$cur" in > --config=*) > __git_complete_config_variable_name_and_value --cur="${cur##--config=}"; > return > ;; > --*) > __gitcomp_builtin clone; > return > ;; > esac >} >_git_commit () >{ > case "$prev" in > -c | -C) > __git_complete_refs; > return > ;; > esac; > case "$cur" in > --cleanup=*) > __gitcomp "default scissors strip verbatim whitespace > " "" "${cur##--cleanup=}"; > return > ;; > --reuse-message=* | --reedit-message=* | --fixup=* | --squash=*) > __git_complete_refs --cur="${cur#*=}"; > return > ;; > --untracked-files=*) > __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"; > return > ;; > --*) > __gitcomp_builtin commit; > return > ;; > esac; > if __git rev-parse --verify --quiet HEAD > /dev/null; then > __git_complete_index_file "--committable"; > else > __git_complete_index_file "--cached"; > fi >} >_git_config () >{ > case "$prev" in > --get | --get-all | --unset | --unset-all) > __gitcomp_nl "$(__git_config_get_set_variables)"; > return > ;; > *.*) > __git_complete_config_variable_value; > return > ;; > esac; > case "$cur" in > --*) > __gitcomp_builtin config > ;; > *) > __git_complete_config_variable_name > ;; > esac >} >_git_describe () >{ > case "$cur" in > --*) > __gitcomp_builtin describe; > return > ;; > esac; > __git_complete_refs >} >_git_diff () >{ > __git_has_doubledash && return; > case "$cur" in > --diff-algorithm=*) > __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"; > return > ;; > --submodule=*) > __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"; > return > ;; > --color-moved=*) > __gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}"; > return > ;; > --color-moved-ws=*) > __gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"; > return > ;; > --*) > __gitcomp "$__git_diff_difftool_options"; > return > ;; > esac; > __git_complete_revlist_file >} >_git_difftool () >{ > __git_has_doubledash && return; > case "$cur" in > --tool=*) > __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}"; > return > ;; > --*) > __gitcomp_builtin difftool "$__git_diff_difftool_options"; > return > ;; > esac; > __git_complete_revlist_file >} >_git_fetch () >{ > case "$cur" in > --recurse-submodules=*) > __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"; > return > ;; > --filter=*) > __gitcomp "blob:none blob:limit= sparse:oid=" "" "${cur##--filter=}"; > return > ;; > --*) > __gitcomp_builtin fetch; > return > ;; > esac; > __git_complete_remote_or_refspec >} >_git_format_patch () >{ > case "$cur" in > --thread=*) > __gitcomp " > deep shallow > " "" "${cur##--thread=}"; > return > ;; > --base=* | --interdiff=* | --range-diff=*) > __git_complete_refs --cur="${cur#--*=}"; > return > ;; > --*) > __gitcomp_builtin format-patch "$__git_format_patch_extra_options"; > return > ;; > esac; > __git_complete_revlist >} >_git_fsck () >{ > case "$cur" in > --*) > __gitcomp_builtin fsck; > return > ;; > esac >} >_git_gitk () >{ > __gitk_main >} >_git_grep () >{ > __git_has_doubledash && return; > case "$cur" in > --*) > __gitcomp_builtin grep; > return > ;; > esac; > case "$cword,$prev" in > 2,* | *,-*) > __git_complete_symbol && return > ;; > esac; > __git_complete_refs >} >_git_help () >{ > case "$cur" in > --*) > __gitcomp_builtin help; > return > ;; > esac; > if test -n "$GIT_TESTING_ALL_COMMAND_LIST"; then > __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk"; > else > __gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk"; > fi >} >_git_init () >{ > case "$cur" in > --shared=*) > __gitcomp " > false true umask group all world everybody > " "" "${cur##--shared=}"; > return > ;; > --*) > __gitcomp_builtin init; > return > ;; > esac >} >_git_log () >{ > __git_has_doubledash && return; > __git_find_repo_path; > local merge=""; > if [ -f "$__git_repo_path/MERGE_HEAD" ]; then > merge="--merge"; > fi; > case "$prev,$cur" in > -L,:*:*) > return > ;; > -L,:*) > __git_complete_symbol --cur="${cur#:}" --sfx=":"; > return > ;; > -G,* | -S,*) > __git_complete_symbol; > return > ;; > esac; > case "$cur" in > --pretty=* | --format=*) > __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) > " "" "${cur#*=}"; > return > ;; > --date=*) > __gitcomp "$__git_log_date_formats" "" "${cur##--date=}"; > return > ;; > --decorate=*) > __gitcomp "full short no" "" "${cur##--decorate=}"; > return > ;; > --diff-algorithm=*) > __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"; > return > ;; > --submodule=*) > __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"; > return > ;; > --no-walk=*) > __gitcomp "sorted unsorted" "" "${cur##--no-walk=}"; > return > ;; > --*) > __gitcomp " > $__git_log_common_options > $__git_log_shortlog_options > $__git_log_gitk_options > --root --topo-order --date-order --reverse > --follow --full-diff > --abbrev-commit --no-abbrev-commit --abbrev= > --relative-date --date= > --pretty= --format= --oneline > --show-signature > --cherry-mark > --cherry-pick > --graph > --decorate --decorate= --no-decorate > --walk-reflogs > --no-walk --no-walk= --do-walk > --parents --children > --expand-tabs --expand-tabs= --no-expand-tabs > $merge > $__git_diff_common_options > --pickaxe-all --pickaxe-regex > "; > return > ;; > -L:*:*) > return > ;; > -L:*) > __git_complete_symbol --cur="${cur#-L:}" --sfx=":"; > return > ;; > -G*) > __git_complete_symbol --pfx="-G" --cur="${cur#-G}"; > return > ;; > -S*) > __git_complete_symbol --pfx="-S" --cur="${cur#-S}"; > return > ;; > esac; > __git_complete_revlist >} >_git_ls_files () >{ > case "$cur" in > --*) > __gitcomp_builtin ls-files; > return > ;; > esac; > __git_complete_index_file "--cached" >} >_git_ls_remote () >{ > case "$cur" in > --*) > __gitcomp_builtin ls-remote; > return > ;; > esac; > __gitcomp_nl "$(__git_remotes)" >} >_git_ls_tree () >{ > case "$cur" in > --*) > __gitcomp_builtin ls-tree; > return > ;; > esac; > __git_complete_file >} >_git_merge () >{ > __git_complete_strategy && return; > case "$cur" in > --*) > __gitcomp_builtin merge; > return > ;; > esac; > __git_complete_refs >} >_git_merge_base () >{ > case "$cur" in > --*) > __gitcomp_builtin merge-base; > return > ;; > esac; > __git_complete_refs >} >_git_mergetool () >{ > case "$cur" in > --tool=*) > __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"; > return > ;; > --*) > __gitcomp "--tool= --prompt --no-prompt --gui --no-gui"; > return > ;; > esac >} >_git_mv () >{ > case "$cur" in > --*) > __gitcomp_builtin mv; > return > ;; > esac; > if [ $(__git_count_arguments "mv") -gt 0 ]; then > __git_complete_index_file "--cached --others --directory"; > else > __git_complete_index_file "--cached"; > fi >} >_git_notes () >{ > local subcommands='add append copy edit get-ref list merge prune remove show'; > local subcommand="$(__git_find_on_cmdline "$subcommands")"; > case "$subcommand,$cur" in > ,--*) > __gitcomp_builtin notes > ;; > ,*) > case "$prev" in > --ref) > __git_complete_refs > ;; > *) > __gitcomp "$subcommands --ref" > ;; > esac > ;; > *,--reuse-message=* | *,--reedit-message=*) > __git_complete_refs --cur="${cur#*=}" > ;; > *,--*) > __gitcomp_builtin notes_$subcommand > ;; > prune,* | get-ref,*) > > ;; > *) > case "$prev" in > -m | -F) > > ;; > *) > __git_complete_refs > ;; > esac > ;; > esac >} >_git_pull () >{ > __git_complete_strategy && return; > case "$cur" in > --recurse-submodules=*) > __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"; > return > ;; > --*) > __gitcomp_builtin pull; > return > ;; > esac; > __git_complete_remote_or_refspec >} >_git_push () >{ > case "$prev" in > --repo) > __gitcomp_nl "$(__git_remotes)"; > return > ;; > --recurse-submodules) > __gitcomp "$__git_push_recurse_submodules"; > return > ;; > esac; > case "$cur" in > --repo=*) > __gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}"; > return > ;; > --recurse-submodules=*) > __gitcomp "$__git_push_recurse_submodules" "" "${cur##--recurse-submodules=}"; > return > ;; > --force-with-lease=*) > __git_complete_force_with_lease "${cur##--force-with-lease=}"; > return > ;; > --*) > __gitcomp_builtin push; > return > ;; > esac; > __git_complete_remote_or_refspec >} >_git_range_diff () >{ > case "$cur" in > --*) > __gitcomp " > --creation-factor= --no-dual-color > $__git_diff_common_options > "; > return > ;; > esac; > __git_complete_revlist >} >_git_rebase () >{ > __git_find_repo_path; > if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then > __gitcomp "$__git_rebase_interactive_inprogress_options"; > return; > else > if [ -d "$__git_repo_path"/rebase-apply ] || [ -d "$__git_repo_path"/rebase-merge ]; then > __gitcomp "$__git_rebase_inprogress_options"; > return; > fi; > fi; > __git_complete_strategy && return; > case "$cur" in > --whitespace=*) > __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"; > return > ;; > --onto=*) > __git_complete_refs --cur="${cur##--onto=}"; > return > ;; > --*) > __gitcomp_builtin rebase "" "$__git_rebase_interactive_inprogress_options"; > return > ;; > esac; > __git_complete_refs >} >_git_reflog () >{ > local subcommands="show delete expire"; > local subcommand="$(__git_find_on_cmdline "$subcommands")"; > if [ -z "$subcommand" ]; then > __gitcomp "$subcommands"; > else > __git_complete_refs; > fi >} >_git_remote () >{ > local subcommands=" > add rename remove set-head set-branches > get-url set-url show prune update > "; > local subcommand="$(__git_find_on_cmdline "$subcommands")"; > if [ -z "$subcommand" ]; then > case "$cur" in > --*) > __gitcomp_builtin remote > ;; > *) > __gitcomp "$subcommands" > ;; > esac; > return; > fi; > case "$subcommand,$cur" in > add,--*) > __gitcomp_builtin remote_add > ;; > add,*) > > ;; > set-head,--*) > __gitcomp_builtin remote_set-head > ;; > set-branches,--*) > __gitcomp_builtin remote_set-branches > ;; > set-head,* | set-branches,*) > __git_complete_remote_or_refspec > ;; > update,--*) > __gitcomp_builtin remote_update > ;; > update,*) > __gitcomp "$(__git_remotes) $(__git_get_config_variables "remotes")" > ;; > set-url,--*) > __gitcomp_builtin remote_set-url > ;; > get-url,--*) > __gitcomp_builtin remote_get-url > ;; > prune,--*) > __gitcomp_builtin remote_prune > ;; > *) > __gitcomp_nl "$(__git_remotes)" > ;; > esac >} >_git_replace () >{ > case "$cur" in > --format=*) > __gitcomp "short medium long" "" "${cur##--format=}"; > return > ;; > --*) > __gitcomp_builtin replace; > return > ;; > esac; > __git_complete_refs >} >_git_rerere () >{ > local subcommands="clear forget diff remaining status gc"; > local subcommand="$(__git_find_on_cmdline "$subcommands")"; > if test -z "$subcommand"; then > __gitcomp "$subcommands"; > return; > fi >} >_git_reset () >{ > __git_has_doubledash && return; > case "$cur" in > --*) > __gitcomp_builtin reset; > return > ;; > esac; > __git_complete_refs >} >_git_restore () >{ > case "$prev" in > -s) > __git_complete_refs; > return > ;; > esac; > case "$cur" in > --conflict=*) > __gitcomp "diff3 merge" "" "${cur##--conflict=}" > ;; > --source=*) > __git_complete_refs --cur="${cur##--source=}" > ;; > --*) > __gitcomp_builtin restore > ;; > esac >} >_git_revert () >{ > __git_find_repo_path; > if [ -f "$__git_repo_path"/REVERT_HEAD ]; then > __gitcomp "$__git_revert_inprogress_options"; > return; > fi; > __git_complete_strategy && return; > case "$cur" in > --*) > __gitcomp_builtin revert "" "$__git_revert_inprogress_options"; > return > ;; > esac; > __git_complete_refs >} >_git_rm () >{ > case "$cur" in > --*) > __gitcomp_builtin rm; > return > ;; > esac; > __git_complete_index_file "--cached" >} >_git_send_email () >{ > case "$prev" in > --to | --cc | --bcc | --from) > __gitcomp "$(__git send-email --dump-aliases)"; > return > ;; > esac; > case "$cur" in > --confirm=*) > __gitcomp " > $__git_send_email_confirm_options > " "" "${cur##--confirm=}"; > return > ;; > --suppress-cc=*) > __gitcomp " > $__git_send_email_suppresscc_options > " "" "${cur##--suppress-cc=}"; > return > ;; > --smtp-encryption=*) > __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}"; > return > ;; > --thread=*) > __gitcomp " > deep shallow > " "" "${cur##--thread=}"; > return > ;; > --to=* | --cc=* | --bcc=* | --from=*) > __gitcomp "$(__git send-email --dump-aliases)" "" "${cur#--*=}"; > return > ;; > --*) > __gitcomp_builtin send-email "--annotate --bcc --cc --cc-cmd --chain-reply-to > --compose --confirm= --dry-run --envelope-sender > --from --identity > --in-reply-to --no-chain-reply-to --no-signed-off-by-cc > --no-suppress-from --no-thread --quiet --reply-to > --signed-off-by-cc --smtp-pass --smtp-server > --smtp-server-port --smtp-encryption= --smtp-user > --subject --suppress-cc= --suppress-from --thread --to > --validate --no-validate > $__git_format_patch_extra_options"; > return > ;; > esac; > __git_complete_revlist >} >_git_shortlog () >{ > __git_has_doubledash && return; > case "$cur" in > --*) > __gitcomp " > $__git_log_common_options > $__git_log_shortlog_options > --numbered --summary --email > "; > return > ;; > esac; > __git_complete_revlist >} >_git_show () >{ > __git_has_doubledash && return; > case "$cur" in > --pretty=* | --format=*) > __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) > " "" "${cur#*=}"; > return > ;; > --diff-algorithm=*) > __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"; > return > ;; > --submodule=*) > __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"; > return > ;; > --color-moved=*) > __gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}"; > return > ;; > --color-moved-ws=*) > __gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"; > return > ;; > --*) > __gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit > --oneline --show-signature > --expand-tabs --expand-tabs= --no-expand-tabs > $__git_diff_common_options > "; > return > ;; > esac; > __git_complete_revlist_file >} >_git_show_branch () >{ > case "$cur" in > --*) > __gitcomp_builtin show-branch; > return > ;; > esac; > __git_complete_revlist >} >_git_sparse_checkout () >{ > local subcommands="list init set disable"; > local subcommand="$(__git_find_on_cmdline "$subcommands")"; > if [ -z "$subcommand" ]; then > __gitcomp "$subcommands"; > return; > fi; > case "$subcommand,$cur" in > init,--*) > __gitcomp "--cone" > ;; > set,--*) > __gitcomp "--stdin" > ;; > *) > > ;; > esac >} >_git_stage () >{ > _git_add >} >_git_stash () >{ > local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'; > local subcommands='push list show apply clear drop pop create branch'; > local subcommand="$(__git_find_on_cmdline "$subcommands save")"; > if [ -z "$subcommand" -a -n "$(__git_find_on_cmdline "-p")" ]; then > subcommand="push"; > fi; > if [ -z "$subcommand" ]; then > case "$cur" in > --*) > __gitcomp "$save_opts" > ;; > sa*) > if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then > __gitcomp "save"; > fi > ;; > *) > if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then > __gitcomp "$subcommands"; > fi > ;; > esac; > else > case "$subcommand,$cur" in > push,--*) > __gitcomp "$save_opts --message" > ;; > save,--*) > __gitcomp "$save_opts" > ;; > apply,--* | pop,--*) > __gitcomp "--index --quiet" > ;; > drop,--*) > __gitcomp "--quiet" > ;; > list,--*) > __gitcomp "--name-status --oneline --patch-with-stat" > ;; > show,--*) > __gitcomp "$__git_diff_common_options" > ;; > branch,--*) > > ;; > branch,*) > if [ $cword -eq 3 ]; then > __git_complete_refs; > else > __gitcomp_nl "$(__git stash list | sed -n -e 's/:.*//p')"; > fi > ;; > show,* | apply,* | drop,* | pop,*) > __gitcomp_nl "$(__git stash list | sed -n -e 's/:.*//p')" > ;; > *) > > ;; > esac; > fi >} >_git_status () >{ > local complete_opt; > local untracked_state; > case "$cur" in > --ignore-submodules=*) > __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"; > return > ;; > --untracked-files=*) > __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"; > return > ;; > --column=*) > __gitcomp " > always never auto column row plain dense nodense > " "" "${cur##--column=}"; > return > ;; > --*) > __gitcomp_builtin status; > return > ;; > esac; > untracked_state="$(__git_get_option_value "-u" "--untracked-files=" "$__git_untracked_file_modes" "status.showUntrackedFiles")"; > case "$untracked_state" in > no) > complete_opt= > ;; > all | normal | *) > complete_opt="--cached --directory --no-empty-directory --others"; > if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then > complete_opt="$complete_opt --ignored --exclude=*"; > fi > ;; > esac; > __git_complete_index_file "$complete_opt" >} >_git_submodule () >{ > __git_has_doubledash && return; > local subcommands="add status init deinit update set-branch set-url summary foreach sync absorbgitdirs"; > local subcommand="$(__git_find_on_cmdline "$subcommands")"; > if [ -z "$subcommand" ]; then > case "$cur" in > --*) > __gitcomp "--quiet" > ;; > *) > __gitcomp "$subcommands" > ;; > esac; > return; > fi; > case "$subcommand,$cur" in > add,--*) > __gitcomp "--branch --force --name --reference --depth" > ;; > status,--*) > __gitcomp "--cached --recursive" > ;; > deinit,--*) > __gitcomp "--force --all" > ;; > update,--*) > __gitcomp " > --init --remote --no-fetch > --recommend-shallow --no-recommend-shallow > --force --rebase --merge --reference --depth --recursive --jobs > " > ;; > set-branch,--*) > __gitcomp "--default --branch" > ;; > summary,--*) > __gitcomp "--cached --files --summary-limit" > ;; > foreach,--* | sync,--*) > __gitcomp "--recursive" > ;; > *) > > ;; > esac >} >_git_svn () >{ > local subcommands=" > init fetch clone rebase dcommit log find-rev > set-tree commit-diff info create-ignore propget > proplist show-ignore show-externals branch tag blame > migrate mkdirs reset gc > "; > local subcommand="$(__git_find_on_cmdline "$subcommands")"; > if [ -z "$subcommand" ]; then > __gitcomp "$subcommands"; > else > local remote_opts="--username= --config-dir= --no-auth-cache"; > local fc_opts=" > --follow-parent --authors-file= --repack= > --no-metadata --use-svm-props --use-svnsync-props > --log-window-size= --no-checkout --quiet > --repack-flags --use-log-author --localtime > --add-author-from > --recursive > --ignore-paths= --include-paths= $remote_opts > "; > local init_opts=" > --template= --shared= --trunk= --tags= > --branches= --stdlayout --minimize-url > --no-metadata --use-svm-props --use-svnsync-props > --rewrite-root= --prefix= $remote_opts > "; > local cmt_opts=" > --edit --rmdir --find-copies-harder --copy-similarity= > "; > case "$subcommand,$cur" in > fetch,--*) > __gitcomp "--revision= --fetch-all $fc_opts" > ;; > clone,--*) > __gitcomp "--revision= $fc_opts $init_opts" > ;; > init,--*) > __gitcomp "$init_opts" > ;; > dcommit,--*) > __gitcomp " > --merge --strategy= --verbose --dry-run > --fetch-all --no-rebase --commit-url > --revision --interactive $cmt_opts $fc_opts > " > ;; > set-tree,--*) > __gitcomp "--stdin $cmt_opts $fc_opts" > ;; > create-ignore,--* | propget,--* | proplist,--* | show-ignore,--* | show-externals,--* | mkdirs,--*) > __gitcomp "--revision=" > ;; > log,--*) > __gitcomp " > --limit= --revision= --verbose --incremental > --oneline --show-commit --non-recursive > --authors-file= --color > " > ;; > rebase,--*) > __gitcomp " > --merge --verbose --strategy= --local > --fetch-all --dry-run $fc_opts > " > ;; > commit-diff,--*) > __gitcomp "--message= --file= --revision= $cmt_opts" > ;; > info,--*) > __gitcomp "--url" > ;; > branch,--*) > __gitcomp "--dry-run --message --tag" > ;; > tag,--*) > __gitcomp "--dry-run --message" > ;; > blame,--*) > __gitcomp "--git-format" > ;; > migrate,--*) > __gitcomp " > --config-dir= --ignore-paths= --minimize > --no-auth-cache --username= > " > ;; > reset,--*) > __gitcomp "--revision= --parent" > ;; > *) > > ;; > esac; > fi >} >_git_switch () >{ > local dwim_opt="$(__git_checkout_default_dwim_mode)"; > case "$prev" in > -c | -C | --orphan) > __git_complete_refs $dwim_opt --mode="heads"; > return > ;; > *) > > ;; > esac; > case "$cur" in > --conflict=*) > __gitcomp "diff3 merge" "" "${cur##--conflict=}" > ;; > --*) > __gitcomp_builtin switch > ;; > *) > if [ -n "$(__git_find_on_cmdline "--orphan")" ]; then > return; > fi; > if [ -n "$(__git_find_on_cmdline "-c -C -d --detach")" ]; then > __git_complete_refs --mode="refs"; > else > if [ -n "$(__git_find_on_cmdline "--track")" ]; then > __git_complete_refs --mode="remote-heads"; > else > __git_complete_refs $dwim_opt --mode="heads"; > fi; > fi > ;; > esac >} >_git_tag () >{ > local i c=1 f=0; > while [ $c -lt $cword ]; do > i="${words[c]}"; > case "$i" in > -d | --delete | -v | --verify) > __gitcomp_direct "$(__git_tags "" "$cur" " ")"; > return > ;; > -f) > f=1 > ;; > esac; > ((c++)); > done; > case "$prev" in > -m | -F) > > ;; > -* | tag) > if [ $f = 1 ]; then > __gitcomp_direct "$(__git_tags "" "$cur" " ")"; > fi > ;; > *) > __git_complete_refs > ;; > esac; > case "$cur" in > --*) > __gitcomp_builtin tag > ;; > esac >} >_git_whatchanged () >{ > _git_log >} >_git_worktree () >{ > local subcommands="add list lock move prune remove unlock"; > local subcommand subcommand_idx; > subcommand="$(__git_find_on_cmdline --show-idx "$subcommands")"; > subcommand_idx="${subcommand% *}"; > subcommand="${subcommand#* }"; > case "$subcommand,$cur" in > ,*) > __gitcomp "$subcommands" > ;; > *,--*) > __gitcomp_builtin worktree_$subcommand > ;; > add,*) > case "$prev" in > -b | -B) > __git_complete_refs > ;; > -*) > > ;; > *) > if [ $cword -eq $((subcommand_idx+1)) ]; then > :; > else > case "${words[cword-2]}" in > -b | -B) > > ;; > *) > __git_complete_refs > ;; > esac; > fi > ;; > esac > ;; > lock,* | remove,* | unlock,*) > __git_complete_worktree_paths > ;; > move,*) > if [ $cword -eq $((subcommand_idx+1)) ]; then > __git_complete_worktree_paths; > else > :; > fi > ;; > esac >} >_have () >{ > PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &> /dev/null >} >_hg () >{ > local cur prev cmd cmd_index opts i aliashg; > local global_args='--cwd|-R|--repository|--color|--config|--encoding|--encodingmode|--pager'; > local hg="$1"; > local canonical=0; > aliashg=$(alias $hg 2>/dev/null); > if [[ -n "$aliashg" ]]; then > aliashg=${aliashg#"alias $hg='"}; > aliashg=${aliashg%"'"}; > if [[ "${aliashg:0:7}" != "source " ]]; then > hg=$aliashg; > fi; > fi; > COMPREPLY=(); > cur="$2"; > prev="$3"; > for ((i=1; $i<=$COMP_CWORD; i++)) > do > if [[ ${COMP_WORDS[i]} != -* ]]; then > if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then > cmd="${COMP_WORDS[i]}"; > cmd_index=$i; > break; > fi; > fi; > done; > if [[ "$cur" == -* ]]; then > if [ "$(type -t "_hg_opt_$cmd")" = function ] && "_hg_opt_$cmd"; then > _hg_fix_wordlist; > return; > fi; > opts=$(HGPLAINEXCEPT=alias _hg_cmd debugcomplete --options "$cmd"); > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur")); > _hg_fix_wordlist; > return; > fi; > case "$prev" in > -R | --repository) > _hg_paths; > _hg_repos; > _hg_fix_wordlist; > return > ;; > --cwd) > _hg_fix_wordlist; > return > ;; > --color) > local choices='true false yes no always auto never debug'; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$choices' -- "$cur")); > _hg_fix_wordlist; > return > ;; > --pager) > local choices='true false yes no always auto never'; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$choices' -- "$cur")); > _hg_fix_wordlist; > return > ;; > esac; > if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then > _hg_commands; > _hg_fix_wordlist; > return; > fi; > local help; > if _hg_command_specific; then > _hg_fix_wordlist; > return; > fi; > help=$(_hg_cmd help "$cmd"); > if [ $? -ne 0 ]; then > return; > fi; > cmd=${help#hg }; > cmd=${cmd%%[' >']*}; > canonical=1; > _hg_command_specific; > _hg_fix_wordlist >} >_hg_bookmarks () >{ > local bookmarks="$(_hg_cmd bookmarks -q)"; > local IFS=' >'; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur")) >} >_hg_branches () >{ > local branches="$(_hg_cmd branches -q)"; > local IFS=' >'; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur")) >} >_hg_cmd () >{ > HGPLAIN=1 "$hg" "$@" 2> /dev/null >} >_hg_cmd_bisect () >{ > local i subcmd; > for ((i=cmd_index+1; i<=COMP_CWORD; i++)) > do > if [[ ${COMP_WORDS[i]} != -* ]]; then > if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then > subcmd="${COMP_WORDS[i]}"; > break; > fi; > fi; > done; > if [ -z "$subcmd" ] || [ $COMP_CWORD -eq $i ] || [ "$subcmd" = help ]; then > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W 'bad good help init next reset' -- "$cur")); > return; > fi; > case "$subcmd" in > good | bad) > _hg_labels > ;; > esac; > return >} >_hg_cmd_bookmarks () >{ > _hg_bookmarks; > return >} >_hg_cmd_email () >{ > case "$prev" in > -c | --cc | -t | --to | -f | --from | --bcc) > if [ "$(type -t _hg_emails)" = function ]; then > local arg=to; > if [[ "$prev" == @(-f|--from) ]]; then > arg=from; > fi; > local addresses=$(_hg_emails $arg); > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$addresses' -- "$cur")); > fi; > return > ;; > -m | --mbox) > return > ;; > -s | --subject) > return > ;; > esac; > _hg_labels; > return >} >_hg_cmd_qclone () >{ > local count=$(_hg_count_non_option); > if [ $count = 1 ]; then > _hg_paths; > fi; > _hg_repos >} >_hg_cmd_qcommit () >{ > local root=$(_hg_cmd root); > local files=$(cd "$root/.hg/patches" && _hg_cmd status -nmar); > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) >} >_hg_cmd_qdelete () >{ > local qcmd=qunapplied; > if [[ "$prev" = @(-r|--rev) ]]; then > qcmd=qapplied; > fi; > _hg_ext_mq_patchlist $qcmd >} >_hg_cmd_qfinish () >{ > if [[ "$prev" = @(-a|--applied) ]]; then > return; > fi; > _hg_ext_mq_patchlist qapplied >} >_hg_cmd_qfold () >{ > _hg_ext_mq_patchlist qunapplied >} >_hg_cmd_qgoto () >{ > if [[ "$prev" = @(-n|--name) ]]; then > _hg_ext_mq_queues; > return; > fi; > _hg_ext_mq_patchlist qseries >} >_hg_cmd_qguard () >{ > local prefix=''; > if [[ "$cur" == +* ]]; then > prefix=+; > else > if [[ "$cur" == -* ]]; then > prefix=-; > fi; > fi; > local ncur=${cur#[-+]}; > if ! [ "$prefix" ]; then > _hg_ext_mq_patchlist qseries; > return; > fi; > local guards=$(_hg_ext_mq_guards); > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -P $prefix -W '$guards' -- "$ncur")) >} >_hg_cmd_qheader () >{ > _hg_ext_mq_patchlist qseries >} >_hg_cmd_qpop () >{ > if [[ "$prev" = @(-n|--name) ]]; then > _hg_ext_mq_queues; > return; > fi; > _hg_ext_mq_patchlist qapplied >} >_hg_cmd_qpush () >{ > if [[ "$prev" = @(-n|--name) ]]; then > _hg_ext_mq_queues; > return; > fi; > _hg_ext_mq_patchlist qunapplied >} >_hg_cmd_qqueue () >{ > local q; > local queues; > local opts="--list --create --rename --delete --purge"; > queues=$( _hg_cmd qqueue --quiet ); > COMPREPLY=($( compgen -W "${opts} ${queues}" "${cur}" )) >} >_hg_cmd_qrename () >{ > _hg_ext_mq_patchlist qseries >} >_hg_cmd_qsave () >{ > if [[ "$prev" = @(-n|--name) ]]; then > _hg_ext_mq_queues; > return; > fi >} >_hg_cmd_qselect () >{ > local guards=$(_hg_ext_mq_guards); > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$guards' -- "$cur")) >} >_hg_cmd_rebase () >{ > if [[ "$prev" = @(-s|--source|-d|--dest|-b|--base|-r|--rev) ]]; then > _hg_labels; > return; > fi >} >_hg_cmd_shelve () >{ > if [[ "$prev" = @(-d|--delete|-l|--list|-p|--patch|--stat) ]]; then > _hg_shelves; > else > _hg_status "mard"; > fi >} >_hg_cmd_sign () >{ > _hg_labels >} >_hg_cmd_strip () >{ > if [[ "$prev" = @(-B|--bookmark) ]]; then > _hg_bookmarks; > return; > fi; > _hg_labels >} >_hg_cmd_transplant () >{ > case "$prev" in > -s | --source) > _hg_paths; > _hg_repos; > return > ;; > --filter) > return > ;; > esac; > _hg_labels; > return >} >_hg_cmd_unshelve () >{ > _hg_shelves >} >_hg_command_specific () >{ > if [ "$(type -t "_hg_cmd_$cmd")" = function ]; then > "_hg_cmd_$cmd"; > return 0; > fi; > if [ "$cmd" != status ]; then > case "$prev" in > -r | --rev) > if [[ $canonical = 1 || status != "$cmd"* ]]; then > _hg_labels; > return 0; > fi; > return 1 > ;; > -B | --bookmark) > if [[ $canonical = 1 || status != "$cmd"* ]]; then > _hg_bookmarks; > return 0; > fi; > return 1 > ;; > -b | --branch) > if [[ $canonical = 1 || status != "$cmd"* ]]; then > _hg_branches; > return 0; > fi; > return 1 > ;; > esac; > fi; > local aliascmd=$(_hg_cmd showconfig alias.$cmd | awk '{print $1}'); > [ -n "$aliascmd" ] && cmd=$aliascmd; > case "$cmd" in > help) > _hg_commands > ;; > export) > if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then > return 0; > fi; > _hg_labels > ;; > manifest | update | up | checkout | co) > _hg_labels > ;; > pull | push | outgoing | incoming) > _hg_paths; > _hg_repos > ;; > paths) > _hg_paths > ;; > add) > _hg_status "u" > ;; > merge) > _hg_labels > ;; > commit | ci | record | amend) > _hg_status "mar" > ;; > remove | rm) > _hg_debugpathcomplete -n > ;; > forget) > _hg_debugpathcomplete -fa > ;; > diff) > _hg_status "mar" > ;; > revert) > _hg_status "mard" > ;; > clone) > local count=$(_hg_count_non_option); > if [ $count = 1 ]; then > _hg_paths; > fi; > _hg_repos > ;; > debugindex | debugindexdot) > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.i" -- "$cur")) > ;; > debugdata) > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.d" -- "$cur")) > ;; > *) > return 1 > ;; > esac; > return 0 >} >_hg_commands () >{ > local commands; > commands="$(HGPLAINEXCEPT=alias _hg_cmd debugcomplete "$cur")" || commands=""; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur")) >} >_hg_count_non_option () >{ > local i count=0; > local filters="$1"; > for ((i=1; $i<=$COMP_CWORD; i++)) > do > if [[ "${COMP_WORDS[i]}" != -* ]]; then > if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then > continue; > fi; > count=$(($count + 1)); > fi; > done; > echo $(($count - 1)) >} >_hg_debugpathcomplete () >{ > local files="$(_hg_cmd debugpathcomplete $1 "$cur")"; > local IFS=' >'; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) >} >_hg_ext_mq_guards () >{ > _hg_cmd qselect --series | sed -e 's/^.//' >} >_hg_ext_mq_patchlist () >{ > local patches; > patches=$(_hg_cmd $1); > if [ $? -eq 0 ] && [ "$patches" ]; then > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur")); > return 0; > fi; > return 1 >} >_hg_ext_mq_queues () >{ > local root=$(_hg_cmd root); > local n; > for n in $(cd "$root"/.hg && compgen -d -- "$cur"); > do > if [ "$n" != patches ] && [ -e "$root/.hg/$n/series" ]; then > COMPREPLY=(${COMPREPLY[@]:-} "$n"); > fi; > done >} >_hg_fix_wordlist () >{ > local LASTCHAR=' '; > if [ ${#COMPREPLY[@]} = 1 ]; then > [ -d "$COMPREPLY" ] && LASTCHAR=/; > COMPREPLY=$(printf %q%s "$COMPREPLY" "$LASTCHAR"); > else > for ((i=0; i < ${#COMPREPLY[@]}; i++)) > do > [ -d "${COMPREPLY[$i]}" ] && COMPREPLY[$i]=${COMPREPLY[$i]}/; > done; > fi >} >_hg_labels () >{ > local labels="$(_hg_cmd debugnamecomplete "$cur")"; > local IFS=' >'; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$labels' -- "$cur")) >} >_hg_opt_qguard () >{ > local i; > for ((i=cmd_index+1; i<=COMP_CWORD; i++)) > do > if [[ ${COMP_WORDS[i]} != -* ]]; then > if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then > _hg_cmd_qguard; > return 0; > fi; > else > if [ "${COMP_WORDS[i]}" = -- ]; then > _hg_cmd_qguard; > return 0; > fi; > fi; > done; > return 1 >} >_hg_paths () >{ > local paths="$(_hg_cmd paths -q)"; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$paths' -- "$cur")) >} >_hg_repos () >{ > local i; > for i in $(compgen -d -- "$cur"); > do > test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i"); > done >} >_hg_shelves () >{ > local shelves="$(_hg_cmd shelve -ql)"; > local IFS=' >'; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$shelves' -- "$cur")) >} >_hg_status () >{ > if [ -z "$HGCOMPLETE_NOSTATUS" ]; then > local files="$(_hg_cmd status -n$1 "glob:$cur**")"; > local IFS=' >'; > COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")); > fi >} >_included_ssh_config_files () >{ > (($# < 1)) && echo "bash_completion: $FUNCNAME: missing mandatory argument CONFIG" 1>&2; > local configfile i f; > configfile=$1; > local reset=$(shopt -po noglob); > set -o noglob; > local included=($(command sed -ne 's/^[[:blank:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:blank:]]\(.*\)$/\1/p' "${configfile}")); > $reset; > [[ -n ${included-} ]] || return; > for i in "${included[@]}"; > do > if ! [[ $i =~ ^\~.*|^\/.* ]]; then > if [[ $configfile =~ ^\/etc\/ssh.* ]]; then > i="/etc/ssh/$i"; > else > i="$HOME/.ssh/$i"; > fi; > fi; > __expand_tilde_by_ref i; > set +o noglob; > for f in $i; > do > if [[ -r $f ]]; then > config+=("$f"); > _included_ssh_config_files $f; > fi; > done; > $reset; > done >} >_init_completion () >{ > local exclude="" flag outx errx inx OPTIND=1; > while getopts "n:e:o:i:s" flag "$@"; do > case $flag in > n) > exclude+=$OPTARG > ;; > e) > errx=$OPTARG > ;; > o) > outx=$OPTARG > ;; > i) > inx=$OPTARG > ;; > s) > split=false; > exclude+== > ;; > *) > echo "bash_completion: $FUNCNAME: usage error" 1>&2; > return 1 > ;; > esac; > done; > COMPREPLY=(); > local redir="@(?([0-9])<|?([0-9&])>?(>)|>&)"; > _get_comp_words_by_ref -n "$exclude<>&" cur prev words cword; > _variables && return 1; > if [[ $cur == $redir* || ${prev-} == $redir ]]; then > local xspec; > case $cur in > 2'>'*) > xspec=${errx-} > ;; > *'>'*) > xspec=${outx-} > ;; > *'<'*) > xspec=${inx-} > ;; > *) > case $prev in > 2'>'*) > xspec=${errx-} > ;; > *'>'*) > xspec=${outx-} > ;; > *'<'*) > xspec=${inx-} > ;; > esac > ;; > esac; > cur="${cur##$redir}"; > _filedir $xspec; > return 1; > fi; > local i skip; > for ((i = 1; i < ${#words[@]}; 1)) > do > if [[ ${words[i]} == $redir* ]]; then > [[ ${words[i]} == $redir ]] && skip=2 || skip=1; > words=("${words[@]:0:i}" "${words[@]:i+skip}"); > ((i <= cword)) && ((cword -= skip)); > else > ((i++)); > fi; > done; > ((cword <= 0)) && return 1; > prev=${words[cword - 1]}; > [[ -n ${split-} ]] && _split_longopt && split=true; > return 0 >} >_installed_modules () >{ > COMPREPLY=($(compgen -W "$(PATH="$PATH:/sbin" lsmod | > awk '{if (NR != 1) print $1}')" -- "$1")) >} >_ip_addresses () >{ > local n; > case ${1-} in > -a) > n='6\?' > ;; > -6) > n='6' > ;; > *) > n= > ;; > esac; > local PATH=$PATH:/sbin; > local addrs=$({ > LC_ALL=C ifconfig -a || ip addr show > } 2>/dev/null | > command sed -e 's/[[:space:]]addr:/ /' -ne "s|.*inet${n}[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p"); > COMPREPLY+=($(compgen -W "$addrs" -- "${cur-}")) >} >_itwebsettings () >{ > local cur prev opts base; > cur="${COMP_WORDS[COMP_CWORD]}"; > prev="${COMP_WORDS[COMP_CWORD-1]}"; > opts="-help -list -get -info -set -reset -reset -headless -check -verbose"; > COMPREPLY=($(compgen -W "${opts}" -- ${cur})); > return 0 >} >_javaws () >{ > local cur prev opts base; > cur="${COMP_WORDS[COMP_CWORD]}"; > prev="${COMP_WORDS[COMP_CWORD-1]}"; > opts="-version -arg -param -property -update -verbose -nosecurity -noupdate -headless -strict -xml -allowredirect -Xnofork -Xignoreheaders -Xoffline -Xtrustnone -jnlp -html -browser -about -viewer -Xclearcache -Xcacheids -license -help -Xtrustall"; > if [[ $prev == *"-jnlp" || $prev == *"-html" ]]; then > COMPREPLY=($(compgen -f -X "!*" -- ${cur})); > if [ -d "$COMPREPLY" ]; then > COMPREPLY="$COMPREPLY/"; > fi; > return 0; > fi; > if [[ $cur == "" ]]; then > COMPREPLY=($(compgen -W "aa_file_or_url ${opts} zz_file_or_url" -- ${cur})); > return 0; > fi; > if [[ $cur == "-"* ]]; then > COMPREPLY=($(compgen -W "${opts}" -- ${cur})); > return 0; > else > COMPREPLY=($(compgen -f -X "!*" -- ${cur})); > if [ -d "$COMPREPLY" ]; then > COMPREPLY="$COMPREPLY/"; > fi; > return 0; > fi >} >_kernel_versions () >{ > COMPREPLY=($(compgen -W '$(command ls /lib/modules)' -- "$cur")) >} >_kernels () >{ > COMPREPLY=($( command ls /lib/modules | grep "^$cur" )) >} >_known_hosts () >{ > local cur prev words cword; > _init_completion -n : || return; > local options; > [[ ${1-} == -a || ${2-} == -a ]] && options=-a; > [[ ${1-} == -c || ${2-} == -c ]] && options+=" -c"; > _known_hosts_real ${options-} -- "$cur" >} >_known_hosts_real () >{ > local configfile flag prefix="" ifs=$IFS; > local cur suffix="" aliases i host ipv4 ipv6; > local -a kh tmpkh=() khd=() config=(); > local OPTIND=1; > while getopts "ac46F:p:" flag "$@"; do > case $flag in > a) > aliases='yes' > ;; > c) > suffix=':' > ;; > F) > configfile=$OPTARG > ;; > p) > prefix=$OPTARG > ;; > 4) > ipv4=1 > ;; > 6) > ipv6=1 > ;; > *) > echo "bash_completion: $FUNCNAME: usage error" 1>&2; > return 1 > ;; > esac; > done; > if (($# < OPTIND)); then > echo "bash_completion: $FUNCNAME: missing mandatory argument CWORD" 1>&2; > return 1; > fi; > cur=${!OPTIND}; > ((OPTIND += 1)); > if (($# >= OPTIND)); then > echo "bash_completion: $FUNCNAME($*): unprocessed arguments:" "$(while (($# >= OPTIND)); do > printf '%s ' ${!OPTIND} > shift > done)" 1>&2; > return 1; > fi; > [[ $cur == *@* ]] && prefix=$prefix${cur%@*}@ && cur=${cur#*@}; > kh=(); > if [[ -v configfile ]]; then > [[ -r $configfile ]] && config+=("$configfile"); > else > for i in /etc/ssh/ssh_config ~/.ssh/config ~/.ssh2/config; > do > [[ -r $i ]] && config+=("$i"); > done; > fi; > local reset=$(shopt -po noglob); > set -o noglob; > if ((${#config[@]} > 0)); then > for i in "${config[@]}"; > do > _included_ssh_config_files "$i"; > done; > fi; > if ((${#config[@]} > 0)); then > local IFS=' >'; > tmpkh=($(awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u)); > IFS=$ifs; > fi; > if ((${#tmpkh[@]} != 0)); then > local j; > for i in "${tmpkh[@]}"; > do > while [[ $i =~ ^([^\"]*)\"([^\"]*)\"(.*)$ ]]; do > i=${BASH_REMATCH[1]}${BASH_REMATCH[3]}; > j=${BASH_REMATCH[2]}; > __expand_tilde_by_ref j; > [[ -r $j ]] && kh+=("$j"); > done; > for j in $i; > do > __expand_tilde_by_ref j; > [[ -r $j ]] && kh+=("$j"); > done; > done; > fi; > if [[ ! -v configfile ]]; then > for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts ~/.ssh/known_hosts2; > do > [[ -r $i ]] && kh+=("$i"); > done; > for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; > do > [[ -d $i ]] && khd+=("$i"/*pub); > done; > fi; > if ((${#kh[@]} + ${#khd[@]} > 0)); then > if ((${#kh[@]} > 0)); then > for i in "${kh[@]}"; > do > while read -ra tmpkh; do > ((${#tmpkh[@]} == 0)) && continue; > set -- "${tmpkh[@]}"; > [[ $1 == [\|\#]* ]] && continue; > [[ $1 == @* ]] && shift; > local IFS=,; > for host in $1; > do > [[ $host == *[*?]* ]] && continue; > host="${host#[}"; > host="${host%]?(:+([0-9]))}"; > COMPREPLY+=($host); > done; > IFS=$ifs; > done < "$i"; > done; > COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")); > fi; > if ((${#khd[@]} > 0)); then > for i in "${khd[@]}"; > do > if [[ $i == *key_22_$cur*.pub && -r $i ]]; then > host=${i/#*key_22_/}; > host=${host/%.pub/}; > COMPREPLY+=($host); > fi; > done; > fi; > for i in ${!COMPREPLY[*]}; > do > COMPREPLY[i]=$prefix${COMPREPLY[i]}$suffix; > done; > fi; > if [[ ${#config[@]} -gt 0 && -v aliases ]]; then > local -a hosts=($(command sed -ne 's/^[[:blank:]]*[Hh][Oo][Ss][Tt][[:blank:]]\(.*\)$/\1/p' "${config[@]}")); > if ((${#hosts[@]} != 0)); then > COMPREPLY+=($(compgen -P "$prefix" -S "$suffix" -W '${hosts[@]%%[*?%]*}' -X '\!*' -- "$cur")); > fi; > fi; > if [[ -n ${COMP_KNOWN_HOSTS_WITH_AVAHI-} ]] && type avahi-browse &> /dev/null; then > COMPREPLY+=($(compgen -P "$prefix" -S "$suffix" -W "$(avahi-browse -cpr _workstation._tcp 2>/dev/null | > awk -F';' '/^=/ { print $7 }' | sort -u)" -- "$cur")); > fi; > if type ruptime &> /dev/null; then > COMPREPLY+=($(compgen -W "$(ruptime 2>/dev/null | awk '!/^ruptime:/ { print $1 }')" -- "$cur")); > fi; > if [[ -n ${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1} ]]; then > COMPREPLY+=($(compgen -A hostname -P "$prefix" -S "$suffix" -- "$cur")); > fi; > $reset; > if [[ -v ipv4 ]]; then > COMPREPLY=("${COMPREPLY[@]/*:*$suffix/}"); > fi; > if [[ -v ipv6 ]]; then > COMPREPLY=("${COMPREPLY[@]/+([0-9]).+([0-9]).+([0-9]).+([0-9])$suffix/}"); > fi; > if [[ -v ipv4 || -v ipv6 ]]; then > for i in "${!COMPREPLY[@]}"; > do > [[ -n ${COMPREPLY[i]} ]] || unset -v "COMPREPLY[i]"; > done; > fi; > __ltrim_colon_completions "$prefix$cur" >} >_longopt () >{ > local cur prev words cword split; > _init_completion -s || return; > case "${prev,,}" in > --help | --usage | --version) > return > ;; > --!(no-*)dir*) > _filedir -d; > return > ;; > --!(no-*)@(file|path)*) > _filedir; > return > ;; > --+([-a-z0-9_])) > local argtype=$(LC_ALL=C $1 --help 2>&1 | command sed -ne "s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p"); > case ${argtype,,} in > *dir*) > _filedir -d; > return > ;; > *file* | *path*) > _filedir; > return > ;; > esac > ;; > esac; > $split && return; > if [[ $cur == -* ]]; then > COMPREPLY=($(compgen -W "$(LC_ALL=C $1 --help 2>&1 | > while read -r line; do > [[ $line =~ --[A-Za-z0-9]+([-_][A-Za-z0-9]+)*=? ]] && > printf '%s\n' ${BASH_REMATCH[0]} > done)" -- "$cur")); > [[ ${COMPREPLY-} == *= ]] && compopt -o nospace; > else > if [[ $1 == *@(rmdir|chroot) ]]; then > _filedir -d; > else > [[ $1 == *mkdir ]] && compopt -o nospace; > _filedir; > fi; > fi >} >_lyx () >{ > local cur g last; > shopt -q extglob && g=1; > test $g -eq 0 && shopt -s extglob; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > local dbg_cmds=("none info init key gui parser lyxrc kbmap latex mathed font tclass lyxvc lyxserver action lyxlex depend insets files workarea clipboard graphics changes external painting debug any undo scrolling macros rtl locale selection find"); > if [[ $COMP_CWORD > 1 ]]; then > last=${COMP_WORDS[$(($COMP_CWORD - 1))]}; > else > last=''; > fi; > case "$last" in > --export | -e) > _filedir '+(pdf[1234]|PDF[1234]|pdf|PDF|ps|PS|xhtml|XHTML)' > ;; > -dbg) > if [[ $cur == *,* ]]; then > COMPREPLY=($( compgen -W '$dbg_cmds' -P ${cur%,*}, -- ${cur##*,} )); > else > COMPREPLY=($( compgen -W '$dbg_cmds' -- $cur )); > fi > ;; > --force-overwrite | -f) > COMPREPLY=($( compgen -W 'all main none' -- $cur )) > ;; > *) > case "$cur" in > -*) > COMPREPLY=($( compgen -W '-help -userdir -sysdir \ > -geometry -dbg -x --execute -e --export \ > -i --import -version -batch -E --export-to \ > -f --force-overwrite -n --no-remote \ > -r --remote ' -- $cur )) > ;; > *) > _filedir '@(lyx)' > ;; > esac > ;; > esac; > test $g -eq 0 && shopt -u extglob >} >_mac_addresses () >{ > local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'; > local PATH="$PATH:/sbin:/usr/sbin"; > COMPREPLY+=($( > { > LC_ALL=C ifconfig -a || ip link show > } 2>/dev/null | command sed -ne "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]].*/\1/p" -ne "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" -ne "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]].*|\2|p" -ne "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]]*$|\2|p" > )); > COMPREPLY+=($({ > arp -an || ip neigh show > } 2>/dev/null | command sed -ne "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p")); > COMPREPLY+=($(command sed -ne "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null)); > COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")); > __ltrim_colon_completions "$cur" >} >_minimal () >{ > local cur prev words cword split; > _init_completion -s || return; > $split && return; > _filedir >} >_modules () >{ > local modpath; > modpath=/lib/modules/$1; > COMPREPLY=($(compgen -W "$(command ls -RL $modpath 2>/dev/null | > command sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p')" -- "$cur")) >} >_ncpus () >{ > local var=NPROCESSORS_ONLN; > [[ $OSTYPE == *linux* ]] && var=_$var; > local n=$(getconf $var 2>/dev/null); > printf %s ${n:-1} >} >_ndiswrapper () >{ > local cur prev pprev; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > prev=${COMP_WORDS[COMP_CWORD-1]}; > if [ $COMP_CWORD -gt 1 ]; then > pprev=${COMP_WORDS[COMP_CWORD-2]}; > case $pprev in > -d) > _ndiswrapper_drivers; > return 0 > ;; > esac; > fi; > case $prev in > -i) > _filedir; > return 0 > ;; > -d) > _pci_ids; > _usb_ids; > return 0 > ;; > -e) > _ndiswrapper_drivers; > return 0 > ;; > esac; > if [[ "$cur" == -* ]]; then > COMPREPLY=($( compgen -W '-i -d -e -l -m -hotplug' -- $cur )); > fi >} >_ndiswrapper_drivers () >{ > COMPREPLY=($( ndiswrapper -l | awk '/driver present/ {print $1}' |grep "^$cur" )) >} >_netprofile () >{ > local cur; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > COMPREPLY=($( command ls /etc/netprofile/profiles | grep "^$cur" )) >} >_ninja_target () >{ > local cur prev targets dir line targets_command OPTIND; > if _get_comp_words_by_ref cur prev &> /dev/null; then > case $prev in > -f) > _filedir; > return 0 > ;; > -C) > _filedir -d; > return 0 > ;; > esac; > else > cur="${COMP_WORDS[COMP_CWORD]}"; > fi; > if [[ "$cur" == "--"* ]]; then > COMPREPLY=($(compgen -P '--' -W 'version' -- "${cur:2}")); > else > dir="."; > line=$(echo ${COMP_LINE} | cut -d" " -f 2-); > while getopts :C:f:j:l:k:nvd:t: opt $line; do > case $opt in > C) > eval dir="$OPTARG" > ;; > esac; > done; > targets_command="eval ninja -C \"${dir}\" -t targets all 2>/dev/null | cut -d: -f1"; > COMPREPLY=($(compgen -W '`${targets_command}`' -- "$cur")); > fi; > return >} >_parse_help () >{ > eval local cmd="$(quote "$1")"; > local line; > { > case $cmd in > -) > cat > ;; > *) > LC_ALL=C "$(dequote "$cmd")" ${2:---help} 2>&1 > ;; > esac > } | while read -r line; do > [[ $line == *([[:blank:]])-* ]] || continue; > while [[ $line =~ ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+([,_-]+[A-Z0-9]+)?(\.\.+)?\]? ]]; do > line=${line/"${BASH_REMATCH[0]}"/"${BASH_REMATCH[1]}"}; > done; > __parse_options "${line// or /, }"; > done >} >_parse_usage () >{ > eval local cmd="$(quote "$1")"; > local line match option i char; > { > case $cmd in > -) > cat > ;; > *) > LC_ALL=C "$(dequote "$cmd")" ${2:---usage} 2>&1 > ;; > esac > } | while read -r line; do > while [[ $line =~ \[[[:space:]]*(-[^]]+)[[:space:]]*\] ]]; do > match=${BASH_REMATCH[0]}; > option=${BASH_REMATCH[1]}; > case $option in > -?(\[)+([a-zA-Z0-9?])) > for ((i = 1; i < ${#option}; i++)) > do > char=${option:i:1}; > [[ $char != '[' ]] && printf '%s\n' -$char; > done > ;; > *) > __parse_options "$option" > ;; > esac; > line=${line#*"$match"}; > done; > done >} >_pci_ids () >{ > COMPREPLY+=($(compgen -W "$(PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur")) >} >_pgids () >{ > COMPREPLY=($(compgen -W '$(command ps axo pgid=)' -- "$cur")) >} >_pids () >{ > COMPREPLY=($(compgen -W '$(command ps axo pid=)' -- "$cur")) >} >_pnames () >{ > local -a procs; > if [[ ${1-} == -s ]]; then > procs=($(command ps axo comm | command sed -e 1d)); > else > local line i=-1 ifs=$IFS; > IFS=' >'; > local -a psout=($(command ps axo command=)); > IFS=$ifs; > for line in "${psout[@]}"; > do > if ((i == -1)); then > if [[ $line =~ ^(.*[[:space:]])COMMAND([[:space:]]|$) ]]; then > i=${#BASH_REMATCH[1]}; > else > break; > fi; > else > line=${line:i}; > line=${line%% *}; > procs+=($line); > fi; > done; > if ((i == -1)); then > for line in "${psout[@]}"; > do > if [[ $line =~ ^[[(](.+)[])]$ ]]; then > procs+=(${BASH_REMATCH[1]}); > else > line=${line%% *}; > line=${line##@(*/|-)}; > procs+=($line); > fi; > done; > fi; > fi; > COMPREPLY=($(compgen -X "<defunct>" -W '${procs[@]}' -- "$cur")) >} >_policyeditor () >{ > local cur prev opts base; > cur="${COMP_WORDS[COMP_CWORD]}"; > prev="${COMP_WORDS[COMP_CWORD-1]}"; > opts="-help -file -defaultfile -codebase -signedby -principals -verbose"; > COMPREPLY=($(compgen -W "${opts}" -- ${cur})); > return 0 >} >_python_django_completion () >{ > if [[ ${COMP_CWORD} -ge 2 ]]; then > local PYTHON_EXE=${COMP_WORDS[0]##*/}; > if echo "$PYTHON_EXE" | grep -qE "python([3-9]\.[0-9])?"; then > local PYTHON_SCRIPT=${COMP_WORDS[1]##*/}; > if echo "$PYTHON_SCRIPT" | grep -qE "manage\.py|django-admin(\.py)?"; then > COMPREPLY=($( COMP_WORDS=( "${COMP_WORDS[*]:1}" ) > COMP_CWORD=$(( COMP_CWORD-1 )) > DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} )); > fi; > fi; > fi >} >_quote_readline_by_ref () >{ > if [ -z "$1" ]; then > printf -v $2 %s "$1"; > else > if [[ $1 == \'* ]]; then > printf -v $2 %s "${1:1}"; > else > if [[ $1 == ~* ]]; then > printf -v $2 ~%q "${1:1}"; > else > printf -v $2 %q "$1"; > fi; > fi; > fi; > [[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}"; > [[ ${!2} == \$* ]] && eval $2=${!2} >} >_realcommand () >{ > type -P "$1" > /dev/null && { > if type -p realpath > /dev/null; then > realpath "$(type -P "$1")"; > else > if type -p greadlink > /dev/null; then > greadlink -f "$(type -P "$1")"; > else > if type -p readlink > /dev/null; then > readlink -f "$(type -P "$1")"; > else > type -P "$1"; > fi; > fi; > fi > } >} >_rl_enabled () >{ > [[ "$(bind -v)" == *$1+([[:space:]])on* ]] >} >_root_command () >{ > local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin; > local root_command=$1; > _command >} >_service () >{ > local cur prev words cword; > _init_completion || return; > ((cword > 2)) && return; > if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then > _services; > [[ -e /etc/mandrake-release ]] && _xinetd_services; > else > local sysvdirs; > _sysvdirs; > COMPREPLY=($(compgen -W '`command sed -e "y/|/ /" \ > -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \ > ${sysvdirs[0]}/${prev##*/} 2>/dev/null` start stop' -- "$cur")); > fi >} >_services () >{ > local sysvdirs; > _sysvdirs; > local IFS=' >' reset=$(shopt -p nullglob); > shopt -s nullglob; > COMPREPLY=($(printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions|README))); > $reset; > COMPREPLY+=($({ > systemctl list-units --full --all || > systemctl list-unit-files > } 2>/dev/null | > awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }')); > if [[ -x /sbin/upstart-udev-bridge ]]; then > COMPREPLY+=($(initctl list 2>/dev/null | cut -d' ' -f1)); > fi; > COMPREPLY=($(compgen -W '${COMPREPLY[@]#${sysvdirs[0]}/}' -- "$cur")) >} >_shells () >{ > local shell rest; > while read -r shell rest; do > [[ $shell == /* && $shell == "$cur"* ]] && COMPREPLY+=($shell); > done 2> /dev/null < /etc/shells >} >_signals () >{ > local -a sigs=($(compgen -P "${1-}" -A signal "SIG${cur#${1-}}")); > COMPREPLY+=("${sigs[@]/#${1-}SIG/${1-}}") >} >_source_highlight () >{ > local cur prev opts; > COMPREPLY=(); > cur="${COMP_WORDS[COMP_CWORD]}"; > prev="${COMP_WORDS[COMP_CWORD-1]}"; > opts="-h --help -V --version -i --input -o --output -s --src-lang --lang-list --outlang-list -f --out-format -d --doc --no-doc -c --css -T --title -t --tab -H --header -F --footer --style-file --outlang-def --outlang-map --data-dir --output-dir --lang-def --lang-map --show-lang-elements --infer-lang -n --line-number --line-number-ref --line-range --range-separator --range-context --regex-range --gen-references --ctags-file --ctags -v --verbose --statistics --gen-version --check-lang --check-outlang --failsafe -g --debug-langdef --show-regex"; > if [[ "${cur}" == -* || ${COMP_CWORD} -eq 1 ]]; then > COMPREPLY=($(compgen -W "${opts}" -- "${cur}")); > return 0; > fi; > case "${prev}" in > -T | --title | -t | --tab | --gen-references | --line-range | --range-separator | --range-context | --regex-range) > COMPREPLY=() > ;; > -i | --input | -o | --output | -c | --css | -H | --header | -F | --footer | --style-file | --outlang-def | --outlang-map | --lang-def | --lang-map | --show-lang-elements | --ctags-file | --check-lang | --check-outlang | --show-regex) > COMPREPLY=($(compgen -A file -- "${cur}")) > ;; > -s | --src-lang) > COMPREPLY=($(compgen -W "C H ac ada am applescript asm autoconf awk bat bib bison c caml cc changelog clipper cls cobol conf cpp cs csh csharp css d diff docbook dtx el eps erlang fixed-fortran flex fortran free-fortran glsl h haskell haxe hh hpp htm html hx in ini islisp java javalog javascript js kcfg kdevelop kidl ksh l lang langdef latex ldap ldif lex lgt lilypond lisp ll log logtalk lsm lua m4 manifest ml mli moc opa outlang oz pas pascal patch pc perl php php3 php4 php5 pl pm po pot postscript prolog properties proto ps py python rb rc ruby scala scheme sh shell sig sl slang slsh sml spec sql sty style syslog tcl tcsh texinfo tex tk tml txt ui upc vala vbscript xhtml xml xorg y yacc yy" -- "${cur}")) > ;; > -f | --out-format) > COMPREPLY=($(compgen -W "docbook esc html html-css htmltable javadoc latex latexcolor odf texinfo xhtml xhtml-css xhtmltable" -- "${cur}")) > ;; > --data-dir | --output-dir) > COMPREPLY=($(compgen -A directory -- "${cur}")) > ;; > *) > COMPREPLY=($(compgen -W "${opts/${preprev}}" -- "${cur}")) > ;; > esac >} >_split_longopt () >{ > if [[ $cur == --?*=* ]]; then > prev="${cur%%?(\\)=*}"; > cur="${cur#*=}"; > return 0; > fi; > return 1 >} >_subdirectories () >{ > COMPREPLY=($( command ls -F $1 2>/dev/null | awk -F \/ '/\/$/ \ > {print $1}' | grep "^$cur" )) >} >_svn () >{ > local cur cmds cmdOpts pOpts mOpts rOpts qOpts nOpts optsParam opt; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > cmds='add auth blame annotate praise cat changelist cl checkout co cleanup'; > cmds="$cmds commit ci copy cp delete remove rm diff export help import"; > cmds="$cmds info list ls lock log merge mergeinfo mkdir move mv rename"; > cmds="$cmds patch propdel pdel propedit pedit propget pget proplist"; > cmds="$cmds plist propset pset relocate resolve resolved revert status"; > cmds="$cmds switch unlock update upgrade"; > cmds="$cmds x-shelf-diff x-shelf-drop x-shelf-list x-shelf-list-by-paths"; > cmds="$cmds x-shelf-log x-shelf-save x-shelve x-shelves x-unshelve"; > local helpOpts='--help -h'; > local specOpts="--version $helpOpts"; > optsParam="-r|--revision|--username|--password|--targets"; > optsParam="$optsParam|-x|--extensions|-m|--message|-F|--file"; > optsParam="$optsParam|--encoding|--diff-cmd|--diff3-cmd|--editor-cmd"; > optsParam="$optsParam|--old|--new|--config-dir|--config-option"; > optsParam="$optsParam|--native-eol|-l|--limit|-c|--change"; > optsParam="$optsParam|--depth|--set-depth|--with-revprop"; > optsParam="$optsParam|--cl|--changelist|--accept|--show-revs"; > optsParam="$optsParam|--show-item"; > local svnProps revProps allProps psCmds propCmds; > svnProps="svn:keywords svn:executable svn:needs-lock svn:externals > svn:ignore svn:eol-style svn:mime-type $SVN_BASH_FILE_PROPS"; > revProps="svn:author svn:log svn:date $SVN_BASH_REV_PROPS"; > allProps=($svnProps $revProps); > psCmds='propset|pset|ps'; > propCmds="$psCmds|propget|pget|pg|propedit|pedit|pe|propdel|pdel|pd"; > local urlSchemas='file:/// http:// https:// svn:// svn+ssh://'; > local cmd= isPropCmd= isPsCmd= isHelpCmd= nExpectArgs= isCur= i=0; > local prev= help= prop= val= isRevProp= last='none' nargs=0 stat=; > local options= hasRevPropOpt= hasRevisionOpt= hasRelocateOpt=; > local acceptOpt= URL= hasReintegrateOpt=; > for opt in "${COMP_WORDS[@]}"; > do > [[ -n $isCur ]] && stat=$last; > isCur=; > [[ $i -eq $COMP_CWORD ]] && isCur=1; > let i++; > [ $last = 'none' ] && { > last='first'; > continue > }; > if [[ $prev == @($optsParam) ]]; then > [[ $prev = '--accept' ]] && acceptOpt=$opt; > prev=''; > last='skip'; > continue; > fi; > if [[ $prev == @(<|>|>>|[12]>|[12]>>) ]]; then > prev=''; > last='skip'; > continue; > fi; > prev=$opt; > if [[ ! -n $cmd && -n $opt && ( $opt != -* || $opt == @(${specOpts// /|}) ) ]]; then > cmd=$opt; > [[ $cmd == @($propCmds) ]] && isPropCmd=1; > [[ $cmd == @($psCmds) ]] && isPsCmd=1; > [[ $cmd == @(${helpOpts// /|}) ]] && cmd='help'; > [[ $cmd = 'help' ]] && isHelpCmd=1; > if [[ -n $isHelpCmd && -n $cmd && $cmd != 'help' && ! -n $help ]]; then > help=$cmd; > cmd='help'; > fi; > last='cmd'; > continue; > fi; > if [[ -n $isHelpCmd && ! -n $help && -n $opt && $opt != -* ]]; then > help=$opt; > last='help'; > continue; > fi; > if [[ -n $isPropCmd && ! -n $prop && -n $opt && $opt != -* ]]; then > prop=$opt; > [[ $prop == @(${revProps// /|}) ]] && isRevProp=1; > last='prop'; > continue; > fi; > if [[ -n $isPsCmd && -n $prop && ! -n $val && $opt != -* ]]; then > val=$opt; > last='val'; > continue; > fi; > if [[ $last != 'onlyarg' ]]; then > case $opt in > -r | --revision | --revision=*) > hasRevisionOpt=1 > ;; > --revprop) > hasRevPropOpt=1; > allProps=($revProps); > nExpectArgs=1 > ;; > -h | --help) > isHelpCmd=1 > ;; > -F | --file) > val='-F' > ;; > --relocate) > hasRelocateOpt=1 > ;; > --reintegrate) > hasReintegrateOpt=1 > ;; > esac; > if [[ $opt = '--' && ! -n $isCur ]]; then > last='onlyarg'; > continue; > fi; > if [[ $opt == -* ]]; then > [[ ! -n $isCur ]] && options="$options $opt "; > last='opt'; > continue; > fi; > else > let nargs++; > continue; > fi; > if [[ $cmd = 'merge' && ! -n $URL ]]; then > URL=$opt; > fi; > last='arg'; > let nargs++; > done; > [[ -n $stat ]] || stat=$last; > if [[ ! -n $cmd || $stat = 'cmd' ]]; then > COMPREPLY=($( compgen -W "$cmds $specOpts" -- $cur )); > return 0; > fi; > if [[ $stat = 'help' || ( -n $isHelpCmd && ! -n $help ) ]]; then > COMPREPLY=($( compgen -W "$cmds" -- $cur )); > return 0; > fi; > if [[ $cmd == @(co|checkout|ls|list) && $stat = 'arg' && $SVN_BASH_COMPL_EXT == *urls* ]]; then > if [[ $cmd == @(ls|list) ]]; then > _svn_complete_target 'all' && return; > else > _svn_complete_target 'remote_only' && return; > fi; > fi; > if [[ $cmd = 'merge' || $cmd = 'mergeinfo' ]]; then > local here=$(_svn_info URL); > if [[ ! -n $URL && $stat = 'arg' ]]; then > if [[ "$here" == */branches/* ]]; then > COMPREPLY=($(compgen -W ${here/\/branches\/*/\/trunk} -- $cur )); > return 0; > else > if [[ "$here" == */trunk* ]]; then > COMPREPLY=($(compgen -W ${here/\/trunk*/\/branches\/} -- $cur )); > compopt -o nospace; > return 0; > else > COMPREPLY=($(compgen -W $(_svn_info Root)/ -- $cur )); > compopt -o nospace; > return 0; > fi; > fi; > else > if [[ $URL == */branches/* && $here == */trunk* && ! -n $hasReintegrateOpt && $cur = '' && $stat = 'arg' ]]; then > COMPREPLY=($(compgen -W '--reintegrate' -- $cur )); > return 0; > else > _svn_complete_target 'all' && return; > fi; > fi; > fi; > if [[ $stat = 'skip' ]]; then > local previous=${COMP_WORDS[COMP_CWORD-1]}; > local values= dirs= beep= exes=; > [[ $previous = '--config-dir' ]] && dirs=1; > [[ $previous = --*-cmd ]] && exes=1; > [[ $previous = '--native-eol' ]] && values='LF CR CRLF'; > [[ $previous = '--limit' ]] && values='0 1 2 3 4 5 6 7 8 9'; > [[ $previous = '--revision' || $previous = '-r' ]] && values='HEAD BASE PREV COMMITTED 0 {'; > [[ $previous = '--encoding' ]] && values="latin1 utf8 $SVN_BASH_ENCODINGS"; > [[ $previous = '--extensions' || $previous = '-x' ]] && values="--unified --ignore-space-change --ignore-all-space --ignore-eol-style --show-c-functions"; > [[ $previous = '--depth' ]] && values='empty files immediates infinity'; > [[ $previous = '--set-depth' ]] && values='empty exclude files immediates infinity'; > [[ $previous = '--accept' ]] && { > if [[ $cmd = 'resolve' ]]; then > values='base working mine-full theirs-full'; > else > values="postpone base mine-full theirs-full edit launch mine-conflict theirs-conflict"; > fi > }; > [[ $previous = '--show-revs' ]] && values='merged eligible'; > [[ $previous = '--show-item' ]] && values="kind url relative-url repos-root-url repos-uuid revision last-changed-revision last-changed-date last-changed-author wc-root"; > if [[ $previous = '--username' ]]; then > values="$SVN_BASH_USERNAME"; > if [[ $SVN_BASH_COMPL_EXT == *username* ]]; then > local file=; > for file in ~/.subversion/auth/svn.simple/*; > do > if [ -r $file ]; then > values="$values $(_svn_read_hashfile username < $file)"; > fi; > done; > fi; > [[ ! -n "$values" ]] && beep=1; > fi; > [[ $previous = '--password' ]] && beep=1; > [[ -n $values ]] && COMPREPLY=($( compgen -W "$values" -- $cur )); > [[ -n $dirs ]] && COMPREPLY=($( compgen -o dirnames -- $cur )); > [[ -n $exes ]] && COMPREPLY=($( compgen -c -- $cur )); > [[ -n $beep ]] && { > echo -en "\a"; > COMPREPLY=('') > }; > return 0; > fi; > if [[ -n $isPropCmd && ( ! -n $prop || $stat = 'prop' ) && $cur != -* ]]; then > local choices=; > if [[ $cur == *:* ]]; then > local prefix=${cur%:*} suffix=${cur#*:} c=; > for c in ${allProps[@]}; > do > [[ $c == $prefix:* ]] && choices="$choices ${c#*:}"; > done; > cur=$suffix; > else > COMPREPLY=($( compgen -W "${allProps[*]}" -- $cur )); > [ ${#COMPREPLY[@]} -eq 1 ] && return 0; > local seen= n=0 last= c=; > for c in ${allProps[@]%:*}; > do > if [[ $c == $cur* && ( ! -n $seen || $c != @($seen) ) ]]; then > let n++; > last=$c; > choices="$choices $c:"; > if [[ -n $seen ]]; then > seen="$seen|$c*"; > else > seen="$c*"; > fi; > fi; > done; > [[ $n -eq 1 ]] && choices="$last:1 $last:2"; > fi; > COMPREPLY=($( compgen -W "$choices" -- $cur )); > return 0; > fi; > if [[ -n $isRevProp && ! -n $hasRevPropOpt ]]; then > COMPREPLY=($( compgen -W '--revprop' -- $cur )); > return 0; > fi; > if [[ -n $isRevProp && -n $hasRevPropOpt && ! -n $hasRevisionOpt ]]; then > COMPREPLY=($( compgen -W '--revision' -- $cur )); > return 0; > fi; > if [[ -n $isPsCmd && -n $prop && ( ! -n $val || $stat = 'val' ) ]]; then > local values="\' --file"; > case $prop in > svn:keywords) > values="Id Rev URL Date Author Header \' $SVN_BASH_KEYWORDS" > ;; > svn:executable | svn:needs-lock) > values='\\*' > ;; > svn:eol-style) > values='native LF CR CRLF' > ;; > svn:mime-type) > values="text/ text/plain text/html text/xml text/rtf > image/ image/png image/gif image/jpeg image/tiff > audio/ audio/midi audio/mpeg > video/ video/mpeg video/mp4 > application/ application/octet-stream > $SVN_BASH_MIME_TYPE" > ;; > esac; > COMPREPLY=($( compgen -W "$values" -- $cur )); > [[ -n ${COMPREPLY} ]] && return 0; > fi; > case $cmd in > merge) > nExpectArgs=3 > ;; > mergeinfo) > nExpectArgs=1 > ;; > copy | cp | move | mv | rename | ren | export | import) > nExpectArgs=2 > ;; > switch | sw) > [[ ! -n $hasRelocateOpt ]] && nExpectArgs=2 > ;; > help | h) > nExpectArgs=0 > ;; > --version) > nExpectArgs=0 > ;; > esac; > if [[ -n $nExpectArgs && $nargs -gt $nExpectArgs ]]; then > echo -en "\a"; > COMPREPLY=(''); > return 0; > fi; > if [[ $cur != -* || $stat = 'onlyarg' ]]; then > if [[ $SVN_BASH_COMPL_EXT == *svnstatus* ]]; then > local status='svn status --non-interactive'; > [[ $SVN_BASH_COMPL_EXT == *recurse* ]] || status="$status --non-recursive"; > [[ $SVN_BASH_COMPL_EXT == *externals* ]] || status="$status --ignore-externals"; > local cs= files=; > [[ -n $cur ]] && cs=$cur*; > case $cmd in > st*) > files=$cur* > ;; > ci | commit | revert | di*) > files=$($status $cs| _svn_grcut '@([MADR!]*| M*|_M*)') > ;; > add) > files=$($status $cs| _svn_grcut '\?*') > ;; > unlock) > files=$($status $cs| _svn_grcut '@(??L*|?????[KOTB]*)') > ;; > resolve*) > files=$($status $cs| _svn_grcut '@(?C*|C*)') > ;; > praise | blame | ann*) > files=$( _svn_lls all $cur* ) > ;; > p*) > if [[ $cmd == @($propCmds) && $prop == @(svn:ignore|svn:externals) ]]; then > files=$( _svn_lls dir . $cur* ); > else > files="$( _svn_lls all $cur* ) > $($status $cs | _svn_grcut 'A*' )"; > fi > ;; > info) > files="$( _svn_lls all $cur* ) > $($status $cs | _svn_grcut 'A*' )" > ;; > remove | rm | del* | move | mv | rename) > files=$( _svn_lls all $cur* ) > ;; > mkdir) > files=$( _svn_lls dir $cur* ) > ;; > log | lock | up* | cl* | switch) > files=$( _svn_lls all $cur* ) > ;; > merge) > files=$( _svn_lls all $cur* ) > ;; > ls | list) > files=$( _svn_lls all $cur* ) > ;; > *) > local fallback=1 > ;; > esac; > if [[ $SVN_BASH_COMPL_EXT != *recurse* ]]; then > files="$files $( _svn_lls dir $cur* )"; > fi; > if [[ -n $files ]]; then > COMPREPLY=($( compgen -W "$files" -- $cur )); > [[ -n "${COMPREPLY[*]}" ]] || COMPREPLY=(''); > else > if [[ ! -n $fallback ]]; then > echo -en "\a"; > COMPREPLY=(''); > fi; > fi; > fi; > return 0; > fi; > pOpts="--username --password --no-auth-cache --non-interactive --password-from-stdin --trust-server-cert-failures --force-interactive"; > mOpts="-m --message -F --file --encoding --force-log --with-revprop --editor-cmd"; > rOpts="-r --revision"; > qOpts="-q --quiet"; > nOpts="-N --non-recursive --depth"; > gOpts="-g --use-merge-history"; > cOpts="--cl --changelist"; > cmdOpts=; > case $cmd in > --version) > cmdOpts="$qOpts" > ;; > add) > cmdOpts="--auto-props --no-auto-props --force --targets --no-ignore --parents $nOpts $qOpts $pOpts" > ;; > auth) > cmdOpts="--remove --show-passwords $pOpts" > ;; > blame | annotate | ann | praise) > cmdOpts="$rOpts $pOpts -v --verbose --incremental --xml -x --extensions --force $gOpts" > ;; > cat) > cmdOpts="$rOpts $pOpts --ignore-keywords" > ;; > changelist | cl) > cmdOpts="--targets $pOpts $qOpts $cOpts -R --recursive --depth --remove" > ;; > checkout | co) > cmdOpts="$rOpts $qOpts $nOpts $pOpts --ignore-externals --force" > ;; > cleanup) > cmdOpts="$pOpts --include-externals -q --quiet --remove-ignored --remove-unversioned --vacuum-pristines" > ;; > commit | ci) > cmdOpts="$mOpts $qOpts $nOpts --targets $pOpts --no-unlock $cOpts --keep-changelists --include-externals" > ;; > copy | cp) > cmdOpts="$mOpts $rOpts $qOpts $pOpts --parents --ignore-externals --pin-externals" > ;; > delete | del | remove | rm) > cmdOpts="--force $mOpts $qOpts --targets $pOpts --keep-local" > ;; > diff | di) > cmdOpts="$rOpts -x --extensions --diff-cmd --no-diff-deleted $nOpts $pOpts --force --old --new --notice-ancestry -c --change --summarize $cOpts --xml --git --internal-diff --show-copies-as-adds --ignore-properties --properties-only --no-diff-added --patch-compatible" > ;; > export) > cmdOpts="$rOpts $qOpts $pOpts $nOpts --force --native-eol --ignore-externals --ignore-keywords" > ;; > help | h | \?) > cmdOpts= > ;; > import) > cmdOpts="--auto-props --no-auto-props $mOpts $qOpts $nOpts --no-ignore $pOpts --force" > ;; > info) > cmdOpts="$pOpts $rOpts --targets -R --recursive --depth --include-externals --incremental --xml --show-item --no-newline $cOpts" > ;; > list | ls) > cmdOpts="$rOpts -v --verbose -R --recursive $pOpts --incremental --search --xml --depth --include-externals" > ;; > lock) > cmdOpts="-m --message -F --file --encoding --force-log $qOpts --targets --force $pOpts" > ;; > log) > cmdOpts="$rOpts -v --verbose --targets $pOpts --stop-on-copy --incremental --xml $qOpts -l --limit -c --change $gOpts --with-all-revprops --with-revprop --depth --diff --diff-cmd -x --extensions --internal-diff --with-no-revprops --search --search-and" > ;; > merge) > cmdOpts="$rOpts $nOpts $qOpts --force --dry-run --diff3-cmd $pOpts --ignore-ancestry -c --change -x --extensions --record-only --accept --allow-mixed-revisions -v --verbose" > ;; > mergeinfo) > cmdOpts="$rOpts $pOpts --depth --show-revs -R --recursive $qOpts -v --verbose --incremental --log" > ;; > mkdir) > cmdOpts="$mOpts $qOpts $pOpts --parents" > ;; > move | mv | rename | ren) > cmdOpts="$mOpts $qOpts --force $pOpts --parents --allow-mixed-revisions" > ;; > patch) > cmdOpts="$qOpts $pOpts --dry-run --ignore-whitespace --reverse-diff --strip" > ;; > propdel | pdel | pd) > cmdOpts="$qOpts -R --recursive $rOpts $pOpts $cOpts --depth"; > [[ -n $isRevProp || ! -n $prop ]] && cmdOpts="$cmdOpts --revprop" > ;; > propedit | pedit | pe) > cmdOpts="$pOpts $mOpts --force"; > [[ -n $isRevProp || ! -n $prop ]] && cmdOpts="$cmdOpts --revprop $rOpts" > ;; > propget | pget | pg) > cmdOpts="-v --verbose -R --recursive $rOpts --no-newline $pOpts $cOpts --depth --xml --show-inherited-props"; > [[ -n $isRevProp || ! -n $prop ]] && cmdOpts="$cmdOpts --revprop" > ;; > proplist | plist | pl) > cmdOpts="-v --verbose -R --recursive $rOpts --revprop $qOpts $pOpts $cOpts --depth --xml --show-inherited-props" > ;; > propset | pset | ps) > cmdOpts="$qOpts --targets -R --recursive --encoding $pOpts --force $cOpts --depth"; > [[ -n $isRevProp || ! -n $prop ]] && cmdOpts="$cmdOpts --revprop $rOpts"; > [[ -n $val ]] || cmdOpts="$cmdOpts -F --file" > ;; > relocate) > cmdOpts="--ignore-externals $pOpts" > ;; > resolve) > cmdOpts="--targets -R --recursive $qOpts $pOpts --accept --depth" > ;; > resolved) > cmdOpts="--targets -R --recursive $qOpts $pOpts --depth" > ;; > revert) > cmdOpts="--targets -R --recursive $qOpts $cOpts --depth $pOpts" > ;; > status | stat | st) > cmdOpts="-u --show-updates -v --verbose $nOpts $qOpts $pOpts --no-ignore --ignore-externals --incremental --xml $rOpts $cOpts" > ;; > switch | sw) > cmdOpts="$rOpts $nOpts $qOpts $pOpts --diff3-cmd --force --accept --ignore-externals --set-depth --ignore-ancestry" > ;; > unlock) > cmdOpts="$qOpts --targets --force $pOpts" > ;; > update | up) > cmdOpts="$rOpts $nOpts $qOpts $pOpts --diff3-cmd --ignore-externals --force --accept $cOpts --parents --editor-cmd --set-depth --adds-as-modification" > ;; > upgrade) > cmdOpts="$qOpts $pOpts" > ;; > x-shelf-list-by-paths) > cmdOpts="$pOpts" > ;; > x-shelf-diff) > cmdOpts="$pOpts --summarize" > ;; > x-shelf-drop) > cmdOpts="$pOpts" > ;; > x-shelf-list | x-shelves) > cmdOpts="$qOpts $pOpts" > ;; > x-shelf-log) > cmdOpts="$qOpts $pOpts" > ;; > x-shelf-save) > cmdOpts="--dry-run --depth --targets $cOpts $mOpts $qOpts $pOpts" > ;; > x-shelve) > cmdOpts="--keep-local --dry-run --depth --targets $cOpts $mOpts $qOpts $pOpts" > ;; > x-unshelve) > cmdOpts="--drop --dry-run $qOpts $pOpts" > ;; > *) > > ;; > esac; > [[ "$cmd" != "--version" ]] && cmdOpts="$cmdOpts $helpOpts"; > cmdOpts="$cmdOpts --config-dir --config-option"; > if [[ $acceptOpt == @(edit|launch) ]]; then > cmdOpts=${cmdOpts/ --non-interactive / }; > fi; > for opt in $options; > do > local optBase; > case $opt in > --*) > optBase=${opt/=*/} > ;; > -*) > optBase=${opt:0:2} > ;; > esac; > cmdOpts=" $cmdOpts "; > cmdOpts=${cmdOpts/ ${optBase} / }; > case $optBase in > -v) > cmdOpts=${cmdOpts/ --verbose / } > ;; > --verbose) > cmdOpts=${cmdOpts/ -v / } > ;; > -N) > cmdOpts=${cmdOpts/ --non-recursive / } > ;; > --non-recursive) > cmdOpts=${cmdOpts/ -N / } > ;; > -R) > cmdOpts=${cmdOpts/ --recursive / } > ;; > --recursive) > cmdOpts=${cmdOpts/ -R / } > ;; > -x) > cmdOpts=${cmdOpts/ --extensions / } > ;; > --extensions) > cmdOpts=${cmdOpts/ -x / } > ;; > -q) > cmdOpts=${cmdOpts/ --quiet / } > ;; > --quiet) > cmdOpts=${cmdOpts/ -q / } > ;; > -h) > cmdOpts=${cmdOpts/ --help / } > ;; > --help) > cmdOpts=${cmdOpts/ -h / } > ;; > -l) > cmdOpts=${cmdOpts/ --limit / } > ;; > --limit) > cmdOpts=${cmdOpts/ -l / } > ;; > -r) > cmdOpts=${cmdOpts/ --revision / } > ;; > --revision) > cmdOpts=${cmdOpts/ -r / } > ;; > -c) > cmdOpts=${cmdOpts/ --change / } > ;; > --change) > cmdOpts=${cmdOpts/ -c / } > ;; > --auto-props) > cmdOpts=${cmdOpts/ --no-auto-props / } > ;; > --no-auto-props) > cmdOpts=${cmdOpts/ --auto-props / } > ;; > -g) > cmdOpts=${cmdOpts/ --use-merge-history / } > ;; > --use-merge-history) > cmdOpts=${cmdOpts/ -g / } > ;; > -m | --message | -F | --file) > cmdOpts=${cmdOpts/ --message / }; > cmdOpts=${cmdOpts/ -m / }; > cmdOpts=${cmdOpts/ --file / }; > cmdOpts=${cmdOpts/ -F / } > ;; > esac; > if [ $isHelpCmd ]; then > cmdOpts=${cmdOpts/ -h / }; > cmdOpts=${cmdOpts/ --help / }; > fi; > done; > COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); > return 0 >} >_svn_complete_target () >{ > local prefix=${COMP_WORDS[COMP_CWORD-2]}; > local colon=${COMP_WORDS[COMP_CWORD-1]}; > if [[ $prefix == "file" && "$colon" == ":" ]]; then > COMPREPLY=($(compgen -d -S '/' -X '*/.*' -- $cur )); > return; > else > if [[ ( $1 == "all" && $cur == ^/* ) || ( "$colon" == ":" && $cur == //*/* ) ]]; then > local p; > if [ "$colon" == ":" ]; then > p="$prefix$colon"; > fi; > if [[ $cur =~ ((.*/)([^/]*)) ]]; then > local url="${BASH_REMATCH[2]}"; > local path="${BASH_REMATCH[3]}"; > local remote_files="$(svn ls --non-interactive "$p$url" 2> /dev/null )"; > COMPREPLY=($(compgen -P "$url" -W "$remote_files" -- "$path" )); > compopt -o nospace; > return 0; > fi; > else > if [[ "$colon" == ":" ]]; then > if [[ $prefix == "svn+ssh" && $cur =~ (^//(.*)) ]]; then > local server_start=${BASH_REMATCH[2]}; > local suffix=/; > _known_hosts_real -p // "$server_start"; > else > local urls= file=; > for file in ~/.subversion/auth/svn.simple/*; > do > if [ -r $file ]; then > local url=$(_svn_read_hashfile svn:realmstring < $file); > url=${url/*</}; > url=${url/>*/}; > urls="$urls $url"; > fi; > done; > local suffix=$cur c= choices=; > for c in $urls; > do > [[ $c == $prefix:* ]] && choices="$choices ${c#*:}"; > done; > COMPREPLY=($(compgen -W "$choices" -- $suffix )); > fi; > compopt -o nospace; > return; > else > if [ $1 == 'all' ]; then > COMPREPLY=($(compgen -W "^/ $urlSchemas" -- $cur)); > else > COMPREPLY=($(compgen -W "$urlSchemas" -- $cur)); > fi; > compopt -o nospace; > return; > fi; > fi; > fi; > return 1 >} >_svn_grcut () >{ > local re=$1 line= old_IFS; > old_IFS="$IFS"; > IFS=' >'; > while read -r line; do > [[ ! -n $re || $line == $re ]] && echo "${line/????????/}"; > done; > IFS="$old_IFS" >} >_svn_info () >{ > local what=$1 line=; > LANG=C LC_MESSAGES=C svn info --non-interactive 2> /dev/null | while read line; do > [[ $line == *"$what: "* ]] && echo ${line#*: }; > done >} >_svn_lls () >{ > local opt=$1 f=; > shift; > for f in "$@"; > do > if [[ $opt == @(dir|all) && -d "$f" ]]; then > echo "$f/"; > else > if [[ $opt == @(file|all) ]]; then > local dn= fn="$f"; > [[ "$f" == */* ]] && dn=${f%\/*}/ fn=${f##*\/}; > [ -f "${dn}.svn/text-base/${fn}.svn-base" ] && echo "$f"; > fi; > fi; > done >} >_svn_read_hashfile () >{ > local tkey=$1 key= val=; > while true; do > read tag len; > [ $tag = 'END' ] && break; > [ $tag != 'K' ] && { > return > }; > read -r -n $len key; > read; > read tag len; > [ $tag != 'V' ] && { > return > }; > read -r -n $len val; > read; > if [[ $key = $tkey ]]; then > echo "$val"; > return; > fi; > done >} >_svnadmin () >{ > local cur cmds cmdOpts optsParam opt helpCmds optBase i; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > cmds='build-repcache crashtest create delrevprop deltify dump dump-revprops freeze \ > help hotcopy info list-dblogs list-unused-dblogs \ > load load-revprops lock lslocks lstxns pack recover rev-size rmlocks \ > rmtxns setlog setrevprop setuuid unlock upgrade verify --version'; > if [[ $COMP_CWORD -eq 1 ]]; then > COMPREPLY=($( compgen -W "$cmds" -- $cur )); > return 0; > fi; > optsParam="-r|--revision|--parent-dir|--fs-type|-M|--memory-cache-size"; > optsParam="$optsParam|-F|--file|--exclude|--include"; > helpCmds='help|--help|h|\?'; > if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && [[ "$cur" != -* ]] || [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]]; then > return 0; > fi; > cmdOpts=; > case ${COMP_WORDS[1]} in > build-repcache) > cmdOpts="-r --revision -q --quiet -M --memory-cache-size" > ;; > create) > cmdOpts="--bdb-txn-nosync --bdb-log-keep --config-dir --fs-type --compatible-version" > ;; > deltify) > cmdOpts="-r --revision -q --quiet -M --memory-cache-size" > ;; > dump) > cmdOpts="-r --revision --incremental -q --quiet --deltas -M --memory-cache-size -F --file --exclude --include --pattern" > ;; > dump-revprops) > cmdOpts="-r --revision -q --quiet -F --file" > ;; > freeze) > cmdOpts="-F --file" > ;; > help | h | \?) > cmdOpts="$cmds" > ;; > hotcopy) > cmdOpts="--clean-logs --incremental -q --quiet" > ;; > load) > cmdOpts="--ignore-uuid --force-uuid --parent-dir -q --quiet --use-pre-commit-hook --use-post-commit-hook --bypass-prop-validation -M --memory-cache-size --no-flush-to-disk --normalize-props -F --file --ignore-dates -r --revision" > ;; > load-revprops) > cmdOpts="-r --revision -q --quiet -F --file --bypass-prop-validation --normalize-props --force-uuid --no-flush-to-disk" > ;; > lstxns) > cmdOpts="-r --revision" > ;; > lock | unlock) > cmdOpts="--bypass-hooks -q --quiet" > ;; > pack) > cmdOpts="-M --memory-cache-size -q --quiet" > ;; > recover) > cmdOpts="--wait" > ;; > rev-size) > cmdOpts="-r --revision -M --memory-cache-size -q --quiet" > ;; > rmlocks) > cmdOpts="-q --quiet" > ;; > rmtxns) > cmdOpts="-q --quiet" > ;; > setlog) > cmdOpts="-r --revision --bypass-hooks" > ;; > setrevprop | delrevprop) > cmdOpts="-r --revision -t --transaction --use-pre-revprop-change-hook --use-post-revprop-change-hook" > ;; > verify) > cmdOpts="-r --revision -t --transaction -q --quiet --check-normalization --keep-going -M --memory-cache-size --metadata-only" > ;; > *) > > ;; > esac; > cmdOpts="$cmdOpts --help -h"; > for ((i=2; i<=$COMP_CWORD-1; ++i )) > do > opt=${COMP_WORDS[$i]}; > case $opt in > --*) > optBase=${opt/=*/} > ;; > -*) > optBase=${opt:0:2} > ;; > esac; > cmdOpts=" $cmdOpts "; > cmdOpts=${cmdOpts/ ${optBase} / }; > case $optBase in > -q) > cmdOpts=${cmdOpts/ --quiet / } > ;; > --quiet) > cmdOpts=${cmdOpts/ -q / } > ;; > -h) > cmdOpts=${cmdOpts/ --help / } > ;; > --help) > cmdOpts=${cmdOpts/ -h / } > ;; > -r) > cmdOpts=${cmdOpts/ --revision / } > ;; > --revision) > cmdOpts=${cmdOpts/ -r / } > ;; > -t) > cmdOpts=${cmdOpts/ --transaction / } > ;; > --transaction) > cmdOpts=${cmdOpts/ -t / } > ;; > -F) > cmdOpts=${cmdOpts/ --file / } > ;; > --file) > cmdOpts=${cmdOpts/ -F / } > ;; > -M) > cmdOpts=${cmdOpts/ --memory-cache-size / } > ;; > --memory-cache-size) > cmdOpts=${cmdOpts/ --M / } > ;; > esac; > if [[ $opt == @($optsParam) ]]; then > ((++i)); > fi; > done; > COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); > return 0 >} >_svndumpfilter () >{ > local cur cmds cmdOpts optsParam opt helpCmds optBase i; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > cmds='exclude help include --version'; > if [[ $COMP_CWORD -eq 1 ]]; then > COMPREPLY=($( compgen -W "$cmds" -- $cur )); > return 0; > fi; > optsParam="--targets"; > helpCmds='help|--help|h|\?'; > if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && [[ "$cur" != -* ]] || [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]]; then > return 0; > fi; > cmdOpts=; > case ${COMP_WORDS[1]} in > exclude | include) > cmdOpts="--drop-empty-revs --drop-all-empty-revs --renumber-revs > --skip-missing-merge-sources --targets > --preserve-revprops --quiet --pattern" > ;; > help | h | \?) > cmdOpts="$cmds" > ;; > *) > > ;; > esac; > cmdOpts="$cmdOpts --help -h"; > for ((i=2; i<=$COMP_CWORD-1; ++i )) > do > opt=${COMP_WORDS[$i]}; > case $opt in > --*) > optBase=${opt/=*/} > ;; > -*) > optBase=${opt:0:2} > ;; > esac; > cmdOpts=" $cmdOpts "; > cmdOpts=${cmdOpts/ ${optBase} / }; > case $optBase in > -h) > cmdOpts=${cmdOpts/ --help / } > ;; > --help) > cmdOpts=${cmdOpts/ -h / } > ;; > esac; > if [[ $opt == @($optsParam) ]]; then > ((++i)); > fi; > done; > COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); > return 0 >} >_svnlook () >{ > local cur cmds cmdOpts optsParam opt helpCmds optBase i; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > cmds='author cat changed date diff dirs-changed filesize help history \ > info lock log propget proplist tree uuid youngest --version'; > if [[ $COMP_CWORD -eq 1 ]]; then > COMPREPLY=($( compgen -W "$cmds" -- $cur )); > return 0; > fi; > optsParam="-r|--revision|-t|--transaction|-l|--limit|-x|--extensions"; > helpCmds='help|--help|h|\?'; > if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && [[ "$cur" != -* ]] || [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]]; then > return 0; > fi; > cmdOpts=; > case ${COMP_WORDS[1]} in > author) > cmdOpts="-r --revision -t --transaction" > ;; > cat) > cmdOpts="-r --revision -t --transaction" > ;; > changed) > cmdOpts="-r --revision -t --transaction --copy-info" > ;; > date) > cmdOpts="-r --revision -t --transaction" > ;; > diff) > cmdOpts="-r --revision -t --transaction --diff-copy-from --no-diff-added --no-diff-deleted -x --extensions" > ;; > dirs-changed) > cmdOpts="-r --revision -t --transaction" > ;; > filesize) > cmdOpts="-r --revision -t --transaction" > ;; > help | h | \?) > cmdOpts="$cmds" > ;; > history) > cmdOpts="-r --revision -l --limit --show-ids" > ;; > info) > cmdOpts="-r --revision -t --transaction" > ;; > lock) > cmdOpts= > ;; > log) > cmdOpts="-r --revision -t --transaction" > ;; > propget | pget | pg) > cmdOpts="-r --revision -t --transaction --revprop" > ;; > proplist | plist | pl) > cmdOpts="-r --revision -t --transaction --revprop -v --verbose --xml" > ;; > tree) > cmdOpts="-r --revision -t --transaction --full-paths -N --non-recursive --show-ids" > ;; > uuid) > cmdOpts= > ;; > youngest) > cmdOpts= > ;; > *) > > ;; > esac; > cmdOpts="$cmdOpts --help -h"; > for ((i=2; i<=$COMP_CWORD-1; ++i )) > do > opt=${COMP_WORDS[$i]}; > case $opt in > --*) > optBase=${opt/=*/} > ;; > -*) > optBase=${opt:0:2} > ;; > esac; > cmdOpts=" $cmdOpts "; > cmdOpts=${cmdOpts/ ${optBase} / }; > case $optBase in > -N) > cmdOpts=${cmdOpts/ --non-recursive / } > ;; > --non-recursive) > cmdOpts=${cmdOpts/ -N / } > ;; > -h) > cmdOpts=${cmdOpts/ --help / } > ;; > --help) > cmdOpts=${cmdOpts/ -h / } > ;; > -l) > cmdOpts=${cmdOpts/ --limit / } > ;; > --limit) > cmdOpts=${cmdOpts/ -l / } > ;; > -r) > cmdOpts=${cmdOpts/ --revision / } > ;; > --revision) > cmdOpts=${cmdOpts/ -r / } > ;; > -t) > cmdOpts=${cmdOpts/ --transaction / } > ;; > --transaction) > cmdOpts=${cmdOpts/ -t / } > ;; > -v) > cmdOpts=${cmdOpts/ --verbose / } > ;; > --verbose) > cmdOpts=${cmdOpts/ -v / } > ;; > -x) > cmdOpts=${cmdOpts/ --extensions / } > ;; > --extensions) > cmdOpts=${cmdOpts/ -x / } > ;; > esac; > if [[ $opt == @($optsParam) ]]; then > ((++i)); > fi; > done; > COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); > return 0 >} >_svnsync () >{ > local cur cmds cmdOpts optsParam opt helpCmds optBase i; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > cmds='copy-revprops help info initialize synchronize --version'; > if [[ $COMP_CWORD -eq 1 ]]; then > COMPREPLY=($( compgen -W "$cmds" -- $cur )); > return 0; > fi; > optsParam="--config-dir|--config-option|--source-username|--source-password"; > optsParam="$optsParam|--sync-username|--sync-password"; > helpCmds='help|--help|h|\?'; > if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && [[ "$cur" != -* ]] || [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]]; then > return 0; > fi; > cmdOpts=; > case ${COMP_WORDS[1]} in > copy-revprops | initialize | init | synchronize | sync) > cmdOpts="--non-interactive --no-auth-cache --trust-server-cert --source-username --source-password --sync-username --sync-password --config-dir --config-option -q --quiet -M --memory-cache-size" > ;; > help | h | \?) > cmdOpts="$cmds" > ;; > info) > cmdOpts="--non-interactive --no-auth-cache --trust-server-cert --source-username --source-password --sync-username --sync-password --config-dir --config-option" > ;; > *) > > ;; > esac; > cmdOpts="$cmdOpts --help -h"; > for ((i=2; i<=$COMP_CWORD-1; ++i )) > do > opt=${COMP_WORDS[$i]}; > case $opt in > --*) > optBase=${opt/=*/} > ;; > -*) > optBase=${opt:0:2} > ;; > esac; > cmdOpts=" $cmdOpts "; > cmdOpts=${cmdOpts/ ${optBase} / }; > case $optBase in > -h) > cmdOpts=${cmdOpts/ --help / } > ;; > --help) > cmdOpts=${cmdOpts/ -h / } > ;; > -q) > cmdOpts=${cmdOpts/ --quiet / } > ;; > --quiet) > cmdOpts=${cmdOpts/ -q / } > ;; > esac; > if [[ $opt == @($optsParam) ]]; then > ((++i)); > fi; > done; > COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); > return 0 >} >_svnversion () >{ > local cmdOpts=" -n --no-newline -c --committed -h --help --version "; > local cur=${COMP_WORDS[COMP_CWORD]}; > COMPREPLY=(); > local options= wcpath= trailurl= last='none' stat= opt= i=-1 isCur=; > for opt in ${COMP_WORDS[@]}; > do > [[ $i -eq $COMP_CWORD ]] && stat=$last; > let i++; > isCur=; > [[ $i -eq $COMP_CWORD ]] && isCur=1; > if [ $last = 'none' ]; then > last='first'; > continue; > fi; > if [[ $last != 'arg' && $opt == -* ]]; then > if [[ $opt = '--' && ! -n $isCur ]]; then > last='arg'; > else > options="$options $opt "; > last='opt'; > fi; > continue; > fi; > if [[ $opt != -* ]]; then > last='arg'; > if [[ ! -n $wcpath ]]; then > wcpath=$opt; > else > if [[ ! -n $trailurl ]]; then > trailurl=$opt; > fi; > fi; > fi; > done; > [[ -n $stat ]] || stat=$last; > if [[ $cur != -* || $stat = 'arg' ]]; then > [[ -n $wcpath && -n $trailurl ]] && COMPREPLY=(''); > return 0; > fi; > for opt in $options; > do > cmdOpts=${cmdOpts/ $opt / }; > case $opt in > -n) > cmdOpts=${cmdOpts/ --no-newline / } > ;; > --no-newline) > cmdOpts=${cmdOpts/ -n / } > ;; > -h) > cmdOpts=${cmdOpts/ --help / } > ;; > --help) > cmdOpts=${cmdOpts/ -h / } > ;; > -c) > cmdOpts=${cmdOpts/ --committed / } > ;; > --committed) > cmdOpts=${cmdOpts/ -c / } > ;; > esac; > done; > COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); > return 0 >} >_sysvdirs () >{ > sysvdirs=(); > [[ -d /etc/rc.d/init.d ]] && sysvdirs+=(/etc/rc.d/init.d); > [[ -d /etc/init.d ]] && sysvdirs+=(/etc/init.d); > [[ -f /etc/slackware-version ]] && sysvdirs=(/etc/rc.d); > return 0 >} >_terms () >{ > COMPREPLY+=($(compgen -W "$({ > command sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap > { > toe -a || toe > } | awk '{ print $1 }' > find /{etc,lib,usr/lib,usr/share}/terminfo/? -type f -maxdepth 1 | > awk -F/ '{ print $NF }' > } 2>/dev/null)" -- "$cur")) >} >_tilde () >{ > local result=0; > if [[ ${1-} == \~* && $1 != */* ]]; then > COMPREPLY=($(compgen -P '~' -u -- "${1#\~}")); > result=${#COMPREPLY[@]}; > ((result > 0)) && compopt -o filenames 2> /dev/null; > fi; > return $result >} >_uids () >{ > if type getent &> /dev/null; then > COMPREPLY=($(compgen -W '$(getent passwd | cut -d: -f3)' -- "$cur")); > else > if type perl &> /dev/null; then > COMPREPLY=($(compgen -W '$(perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"')' -- "$cur")); > else > COMPREPLY=($(compgen -W '$(cut -d: -f3 /etc/passwd)' -- "$cur")); > fi; > fi >} >_upvar () >{ > echo "bash_completion: $FUNCNAME: deprecated function," "use _upvars instead" 1>&2; > if unset -v "$1"; then > if (($# == 2)); then > eval $1=\"\$2\"; > else > eval $1=\(\"\$"{@:2}"\"\); > fi; > fi >} >_upvars () >{ > if ! (($#)); then > echo "bash_completion: $FUNCNAME: usage: $FUNCNAME" "[-v varname value] | [-aN varname [value ...]] ..." 1>&2; > return 2; > fi; > while (($#)); do > case $1 in > -a*) > [[ -n ${1#-a} ]] || { > echo "bash_completion: $FUNCNAME:" "\`$1': missing number specifier" 1>&2; > return 1 > }; > printf %d "${1#-a}" &> /dev/null || { > echo bash_completion: "$FUNCNAME: \`$1': invalid number specifier" 1>&2; > return 1 > }; > [[ -n "$2" ]] && unset -v "$2" && eval $2=\(\"\$"{@:3:${1#-a}}"\"\) && shift $((${1#-a} + 2)) || { > echo bash_completion: "$FUNCNAME: \`$1${2+ }$2': missing argument(s)" 1>&2; > return 1 > } > ;; > -v) > [[ -n "$2" ]] && unset -v "$2" && eval $2=\"\$3\" && shift 3 || { > echo "bash_completion: $FUNCNAME: $1:" "missing argument(s)" 1>&2; > return 1 > } > ;; > *) > echo "bash_completion: $FUNCNAME: $1: invalid option" 1>&2; > return 1 > ;; > esac; > done >} >_urpme () >{ > local cur prev; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > if [[ "$cur" == -* ]]; then > COMPREPLY=($( compgen -W "$common_options -a --auto --test --auto-orphans --parallel --justdb --noscripts" -- $cur )); > else > _xfunc rpm _rpm_installed_packages; > fi >} >_urpmf () >{ > local cur prev; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > prev=${COMP_WORDS[COMP_CWORD-1]}; > case "$prev" in > --media) > _urpmi_medias; > return 0 > ;; > --excludemedia) > _urpmi_medias; > return 0 > ;; > --sortmedia) > _urpmi_medias; > return 0 > ;; > esac; > if [[ "$cur" == -* ]]; then > COMPREPLY=($( compgen -W "$common_options -i -f -e -a -o -m --update --media --excludemedia --literal --sortmedia --synthesis --use-distrib --uniq --name --group --license --size --epoch --summary --description --sourcerpm --packager--buildhost --url --provides --recommends --requires --files --conflicts --obsoletes --env" -- $cur )); > else > _filedir; > fi >} >_urpmi () >{ > local cur prev options; > COMPREPLY=(); > cur=`_get_cword`; > prev=`_get_pword`; > case "$prev" in > --media) > _urpmi_medias; > return 0 > ;; > --excludemedia) > _urpmi_medias; > return 0 > ;; > --sortmedia) > _urpmi_medias; > return 0 > ;; > --searchmedia) > _urpmi_medias; > return 0 > ;; > --parallel) > _urpmi_aliases; > return 0 > ;; > --root | --urpmi-root) > _filedir -d; > return 0 > ;; > esac; > if [[ "$cur" == -* ]]; then > options="$common_options -a -p -P -y --update --media --excludemedia --sortmedia --synthesis --auto --auto-select --no-uninstall --split-level --split-length --fuzzy --buildrequires --install-src --clean --noclean --parallel --wget --prozilla --curl --limit-rate --proxy --proxy-user --bug --no-verify-rpm --no-install --test --excludepath --excludedocs --searchmedia --ignoresize --ignorearch --strict-arch --wget-options --curl-options --prozilla-options --rsync-options --resume --retry --skip --prefer --nolock --more-choices --downgrade --deploops --debug-librpm"; > if [[ ${COMP_WORDS[0]} != *rurpmi ]]; then > options="$options --root --use-distrib --env --auto-orphans --replacepkgs --justdb --allow-nodeps --allow-force --no-recommends --force --noscripts --auto-update --keep --nokeep --replacefiles --verify-rpm"; > for ((i=1; i < COMP_CWORD; i++ )) > do > case ${COMP_WORDS[i]} in > ----auto-update) > options="$options --no-md5sum --force-key" > ;; > esac; > done; > fi; > COMPREPLY=($( compgen -W "$options" -- $cur )); > else > if [[ ${COMP_WORDS[0]} == *rurpmi ]]; then > _urpmi_packages; > else > if [[ "$cur" != */* ]]; then > _urpmi_packages; > fi; > _filedir '@(rpm|spec)'; > fi; > fi >} >_urpmi_addmedia () >{ > local cur i args; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > if [[ "$cur" == -* ]]; then > COMPREPLY=($( compgen -W "$common_options -f --wget --curl --prozilla --limit-rate --proxy --proxy-user --update --raw --probe-synthesis --probe-hdlist --probe-rpms --no-probe --distrib --env --version --arch --virtual --norebuild --nopubkey" -- $cur )); > else > args=$COMP_CWORD; > for ((i=1; i < COMP_CWORD; i++ )) > do > if [[ "${COMP_WORDS[i]}" == -* ]]; then > args=$(($args-1)); > fi; > done; > case $args in > 1) > _urpmi_medias > ;; > 2) > COMPREPLY=($( compgen -W 'file:// http:// \ > ftp:// removable:// ssh:// \ > rsync://' -- $cur )) > ;; > 3) > COMPREPLY=('with') > ;; > esac; > fi >} >_urpmi_aliases () >{ > COMPREPLY=($( awk -F: '{print $1}' /etc/urpmi/parallel.cfg 2>/dev/null | \grep "^${cur//\\\\/}" )) >} >_urpmi_get_medias () >{ > medias=($( urpmq --list-media $1 2>/dev/null | \sed -e 's/(/\\(/g' -e 's/)/\\)/g' -e 's/ /\\ /g' )) >} >_urpmi_medias () >{ > local medias IFS=' >'; > _urpmi_get_medias all; > COMPREPLY=($( compgen -W '${medias[@]}' -- $cur )) >} >_urpmi_packages () >{ > local options; > for ((i=1; i < COMP_CWORD; i++ )) > do > case "${COMP_WORDS[i]}" in > --@\(excludemedia | media\)) > options="$options ${COMP_WORDS[i]} ${COMP_WORDS[i+1]}"; > i=$(($i+1)) > ;; > --update) > options="$options ${COMP_WORDS[i]}" > ;; > esac; > done; > COMPREPLY=($( compgen -W "$(urpmq $options --list | \grep ^$cur )" -- )) >} >_urpmi_removemedia () >{ > local cur; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > if [[ "$cur" == -* ]]; then > COMPREPLY=($( compgen -W "$common_options -a -y" -- $cur )); > else > _urpmi_medias; > fi >} >_urpmi_update () >{ > local cur; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > if [[ "$cur" == -* ]]; then > COMPREPLY=($( compgen -W "$common_options -a -f --wget --prozilla --curl --limit-rate --proxy --proxy-user --update --ignore --no-ignore --no-md5sum --force-key --norebuild" -- $cur)); > else > _urpmi_medias; > fi >} >_urpmq () >{ > local cur prev; > COMPREPLY=(); > cur=${COMP_WORDS[COMP_CWORD]}; > prev=${COMP_WORDS[COMP_CWORD-1]}; > case "$prev" in > --media) > _urpmi_medias; > return 0 > ;; > --excludemedia) > _urpmi_medias; > return 0 > ;; > --sortmedia) > _urpmi_medias; > return 0 > ;; > --parallel) > _urpmi_nodes; > return 0 > ;; > --list-media) > COMPREPLY=($( compgen -W 'all update active' -- $cur)); > return 0 > ;; > esac; > if [[ "$cur" == -* ]]; then > COMPREPLY=($( compgen -W "$common_options -d -u -m -a -c -y -s -i -g -p -r -f -l --update --media --excludemedia --sortmedia --synthesis --auto-select --auto-orphans --not-available --no-recommends --fuzzy --keep --nokeep --list --list-url --list-media --list-nodes --list-aliases --src --sources --provides --requires --obsoletes --recommends --summary --sourcerpm --force --parallel --wget --curl --prozilla --changelog --conflicts --proxy --proxy-user --env --dump-config --whatprovides --whatrequires --whatrequires-recursive --skip --prefer --use-distrib --searchmedia --ignorearch" -- $cur)); > else > _filedir rpm; > fi >} >_usb_ids () >{ > COMPREPLY+=($(compgen -W "$(PATH="$PATH:/sbin" lsusb | awk '{print $6}')" -- "$cur")) >} >_user_at_host () >{ > local cur prev words cword; > _init_completion -n : || return; > if [[ $cur == *@* ]]; then > _known_hosts_real "$cur"; > else > COMPREPLY=($(compgen -u -S @ -- "$cur")); > compopt -o nospace; > fi >} >_usergroup () >{ > if [[ $cur == *\\\\* || $cur == *:*:* ]]; then > return; > else > if [[ $cur == *\\:* ]]; then > local prefix; > prefix=${cur%%*([^:])}; > prefix=${prefix//\\/}; > local mycur="${cur#*[:]}"; > if [[ ${1-} == -u ]]; then > _allowed_groups "$mycur"; > else > local IFS=' >'; > COMPREPLY=($(compgen -g -- "$mycur")); > fi; > COMPREPLY=($(compgen -P "$prefix" -W "${COMPREPLY[@]}")); > else > if [[ $cur == *:* ]]; then > local mycur="${cur#*:}"; > if [[ ${1-} == -u ]]; then > _allowed_groups "$mycur"; > else > local IFS=' >'; > COMPREPLY=($(compgen -g -- "$mycur")); > fi; > else > if [[ ${1-} == -u ]]; then > _allowed_users "$cur"; > else > local IFS=' >'; > COMPREPLY=($(compgen -u -- "$cur")); > fi; > fi; > fi; > fi >} >_userland () >{ > local userland=$(uname -s); > [[ $userland == @(Linux|GNU/*) ]] && userland=GNU; > [[ $userland == "$1" ]] >} >_variables () >{ > if [[ $cur =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]; then > if [[ $cur == '${'* ]]; then > local arrs vars; > vars=($(compgen -A variable -P ${BASH_REMATCH[1]} -S '}' -- ${BASH_REMATCH[3]})); > arrs=($(compgen -A arrayvar -P ${BASH_REMATCH[1]} -S '[' -- ${BASH_REMATCH[3]})); > if ((${#vars[@]} == 1 && ${#arrs[@]} != 0)); then > compopt -o nospace; > COMPREPLY+=(${arrs[*]}); > else > COMPREPLY+=(${vars[*]}); > fi; > else > COMPREPLY+=($(compgen -A variable -P '$' -- "${BASH_REMATCH[3]}")); > fi; > return 0; > else > if [[ $cur =~ ^(\$\{[#!]?)([A-Za-z0-9_]*)\[([^]]*)$ ]]; then > local IFS=' >'; > COMPREPLY+=($(compgen -W '$(printf %s\\n "${!'${BASH_REMATCH[2]}'[@]}")' -P "${BASH_REMATCH[1]}${BASH_REMATCH[2]}[" -S ']}' -- "${BASH_REMATCH[3]}")); > if [[ ${BASH_REMATCH[3]} == [@*] ]]; then > COMPREPLY+=("${BASH_REMATCH[1]}${BASH_REMATCH[2]}[${BASH_REMATCH[3]}]}"); > fi; > __ltrim_colon_completions "$cur"; > return 0; > else > if [[ $cur =~ ^\$\{[#!]?[A-Za-z0-9_]*\[.*\]$ ]]; then > COMPREPLY+=("$cur}"); > __ltrim_colon_completions "$cur"; > return 0; > else > case ${prev-} in > TZ) > cur=/usr/share/zoneinfo/$cur; > _filedir; > for i in "${!COMPREPLY[@]}"; > do > if [[ ${COMPREPLY[i]} == *.tab ]]; then > unset 'COMPREPLY[i]'; > continue; > else > if [[ -d ${COMPREPLY[i]} ]]; then > COMPREPLY[i]+=/; > compopt -o nospace; > fi; > fi; > COMPREPLY[i]=${COMPREPLY[i]#/usr/share/zoneinfo/}; > done; > return 0 > ;; > TERM) > _terms; > return 0 > ;; > LANG | LC_*) > COMPREPLY=($(compgen -W '$(locale -a 2>/dev/null)' -- "$cur")); > return 0 > ;; > esac; > fi; > fi; > fi; > return 1 >} >_xfunc () >{ > set -- "$@"; > local srcfile=$1; > shift; > declare -F $1 &> /dev/null || __load_completion "$srcfile"; > "$@" >} >_xinetd_services () >{ > local xinetddir=${BASHCOMP_XINETDDIR:-/etc/xinetd.d}; > if [[ -d $xinetddir ]]; then > local IFS=' >' reset=$(shopt -p nullglob); > shopt -s nullglob; > local -a svcs=($(printf '%s\n' $xinetddir/!($_backup_glob))); > $reset; > ((!${#svcs[@]})) || COMPREPLY+=($(compgen -W '${svcs[@]#$xinetddir/}' -- "${cur-}")); > fi >} >dequote () >{ > eval printf %s "$1" 2> /dev/null >} >gawklibpath_append () >{ > [ -z "$AWKLIBPATH" ] && AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'`; > export AWKLIBPATH="$AWKLIBPATH:$*" >} >gawklibpath_default () >{ > unset AWKLIBPATH; > export AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'` >} >gawklibpath_prepend () >{ > [ -z "$AWKLIBPATH" ] && AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'`; > export AWKLIBPATH="$*:$AWKLIBPATH" >} >gawkpath_append () >{ > [ -z "$AWKPATH" ] && AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'`; > export AWKPATH="$AWKPATH:$*" >} >gawkpath_default () >{ > unset AWKPATH; > export AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'` >} >gawkpath_prepend () >{ > [ -z "$AWKPATH" ] && AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'`; > export AWKPATH="$*:$AWKPATH" >} >quote () >{ > local quoted=${1//\'/\'\\\'\'}; > printf "'%s'" "$quoted" >} >quote_readline () >{ > local ret; > _quote_readline_by_ref "$1" ret; > printf %s "$ret" >}
ALLOW_CURDIR_IN_PATH=no ANT_HOME=/usr BASH=/bin/bash BASHOPTS=checkhash:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:histappend:interactive_comments:login_shell:no_empty_cmd_completion:progcomp:promptvars:sourcepath BASH_ALIASES=() BASH_ARGC=([0]="0") BASH_ARGV=() BASH_CMDS=() BASH_COMPLETION_VERSINFO=([0]="2" [1]="11") BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="5" [1]="1" [2]="4" [3]="1" [4]="release" [5]="x86_64-mageia-linux-gnu") BASH_VERSION='5.1.4(1)-release' BROWSER=firefox BSNUM=999 CANBERRA_DRIVER=pulse CHARSET=ANSI_X3.4-1968 CLASS=beginner COLUMNS=81 COMP_CONFIGURE_HINTS= COMP_CVS_REMOTE= COMP_IWLIST_SCAN= COMP_KNOWN_HOSTS_WITH_AVAHI= COMP_KNOWN_HOSTS_WITH_HOSTFILE=1 COMP_TAR_INTERNAL_PATHS= COMP_WORDBREAKS=$' \t\n"\'><=;|&(:' CONFIG=/etc/sound/profiles/current/canberra.conf COUNTRY=US DIRSTACK=() DISPLAY=:0 EDITOR=vi ENABLE_BASH_COMPLETION=1 EUID=501 GCONF_TMPDIR=/tmp GROUPS=() G_FILENAME_ENCODING=@locale HISTCONTROL=ignoredups HISTFILE=/home/ftg/.bash_history HISTFILESIZE=1000 HISTSIZE=1000 HOME=/home/ftg HOSTNAME=ftglap HOSTTYPE=x86_64 IFS=$' \t\n' INPUTRC=/etc/inputrc JAVA_HOME=/etc/alternatives/java_sdk JBOSS_DIST=/home/jboss/jbossDist KEYBOARD=us KEYCHAINFILE=/home/ftg/.keychain/ftglap-sh KEYCHAINFILEGPG=/home/ftg/.keychain/ftglap-sh-gpg KEYCHAIN_KEYS= KEYCHAIN_OPTIONS= KEYTABLE=us LADSPA_PATH=/usr/lib64/ladspa/ LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8:en_US:en LC_SOURCED=1 LD_LIBRARY_PATH=:/home/ftg/lib LESSCHARSET=koi8-r LESSOPEN='|/usr/bin/lesspipe.sh %s' LINES=20 LOGNAME=ftg LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.iso=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.JPG=01;35:*.JPEG=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.ico=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.divx=01;35:*.xvid=01;35:*.3gp=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.gem=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*.mp2=00;36:*.mod=00;36:*.xm=00;36:*.s3m=00;36:*.it=00;36:*.wma=00;36:*~=47;30:*.bak=47;30:*.swp=47;30:*.bck=47;30:*.bk=47;30:*.old=47;30:*.tmp=47;30:*.save=47;30:*.rpmsave=47;30:*.rpmnew=47;30:' LS_OPTIONS='-Fhd --color=auto --full-time' M2=/usr/local/apache-maven/bin M2_HOME=/usr/local/apache-maven MACHTYPE=x86_64-mageia-linux-gnu MAIL=/var/spool/mail/ftg MAILCHECK=60 META_CLASS=download MGA_MENU_STYLE=mageia NLSPATH=/usr/share/locale/%l/%N OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PATH=/etc/alternatives/java_sdk/bin:/etc/alternatives/java_sdk/jre/bin:/usr/local/apache-maven/bin:/opt/ibm/java2-i386-50/jre/bin:/opt/ibm/java2-i386-50/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/lib64/qt5/bin:/usr/lib64/qt4/bin:/usr/lib/oracle/11.2/client64/bin:/home/ftg/bin PILOTPORT=usb: PIPESTATUS=([0]="0") PPID=125479 PROMPT_COMMAND='history -a; ' PS1=$'\\[\017\E[10;0m\E[1;32m\\][\\u@\\h \\w]\\$ \\[\017\E[10;0m\\]' PS2='> ' PS4='+ ' PWD=/home/ftg PYTHONSTARTUP=/etc/pythonrc.py QT4DOCDIR=/usr/share/doc/qt4 QT5DOCDIR=/usr/share/doc/qt5 QTDIR=/usr/lib64/qt4 QTDIR5=/usr/lib64/qt5 QTINC=/usr/lib/qt3/include QTLIB=/usr/lib64 QT_XFT=0 SAL_USE_VCLPLUGIN=gtk SCREENDIR=/home/ftg/tmp SECSHELL=1 SECURE_TMP=no SECURITY=3 SHELL=/bin/bash SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor SHLVL=1 SSH_ASKPASS=/usr/libexec/openssh/ssh-askpass SYSTEMD_PAGER='/usr/bin/less -FR' TERM=xterm-256color TMOUT=0 TMP=/tmp TMPDIR=/tmp UID=501 UMASK_ROOT=022 UMASK_USER=022 USER=ftg XAUTHORITY=/home/ftg/.xauthcRgvTk XDG_DATA_DIRS=/home/ftg/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share XkbLayout=us XkbModel=pc105 XkbOptions=compose:rwin _=set __git_all_commands= __git_am_inprogress_options='--skip --continue --resolved --abort --quit --show-current-patch' __git_cherry_pick_inprogress_options='--continue --quit --abort --skip' __git_cmds_with_parseopt_helper= __git_color_moved_opts='no default plain blocks zebra dimmed-zebra' __git_color_moved_ws_opts=$'no ignore-space-at-eol ignore-space-change\n\t\t\tignore-all-space allow-indentation-change' __git_config_vars= __git_diff_algorithms='myers minimal patience histogram' __git_diff_common_options=$'--stat --numstat --shortstat --summary\n\t\t\t--patch-with-stat --name-only --name-status --color\n\t\t\t--no-color --color-words --no-renames --check\n\t\t\t--color-moved --color-moved= --no-color-moved\n\t\t\t--color-moved-ws= --no-color-moved-ws\n\t\t\t--full-index --binary --abbrev --diff-filter=\n\t\t\t--find-copies-harder --ignore-cr-at-eol\n\t\t\t--text --ignore-space-at-eol --ignore-space-change\n\t\t\t--ignore-all-space --ignore-blank-lines --exit-code\n\t\t\t--quiet --ext-diff --no-ext-diff\n\t\t\t--no-prefix --src-prefix= --dst-prefix=\n\t\t\t--inter-hunk-context=\n\t\t\t--patience --histogram --minimal\n\t\t\t--raw --word-diff --word-diff-regex=\n\t\t\t--dirstat --dirstat= --dirstat-by-file\n\t\t\t--dirstat-by-file= --cumulative\n\t\t\t--diff-algorithm=\n\t\t\t--submodule --submodule= --ignore-submodules\n\t\t\t--indent-heuristic --no-indent-heuristic\n\t\t\t--textconv --no-textconv\n\t\t\t--patch --no-patch\n' __git_diff_difftool_options=$'--cached --staged --pickaxe-all --pickaxe-regex\n\t\t\t--base --ours --theirs --no-index --relative --merge-base\n\t\t\t--stat --numstat --shortstat --summary\n\t\t\t--patch-with-stat --name-only --name-status --color\n\t\t\t--no-color --color-words --no-renames --check\n\t\t\t--color-moved --color-moved= --no-color-moved\n\t\t\t--color-moved-ws= --no-color-moved-ws\n\t\t\t--full-index --binary --abbrev --diff-filter=\n\t\t\t--find-copies-harder --ignore-cr-at-eol\n\t\t\t--text --ignore-space-at-eol --ignore-space-change\n\t\t\t--ignore-all-space --ignore-blank-lines --exit-code\n\t\t\t--quiet --ext-diff --no-ext-diff\n\t\t\t--no-prefix --src-prefix= --dst-prefix=\n\t\t\t--inter-hunk-context=\n\t\t\t--patience --histogram --minimal\n\t\t\t--raw --word-diff --word-diff-regex=\n\t\t\t--dirstat --dirstat= --dirstat-by-file\n\t\t\t--dirstat-by-file= --cumulative\n\t\t\t--diff-algorithm=\n\t\t\t--submodule --submodule= --ignore-submodules\n\t\t\t--indent-heuristic --no-indent-heuristic\n\t\t\t--textconv --no-textconv\n\t\t\t--patch --no-patch\n' __git_diff_submodule_formats='diff log short' __git_fetch_recurse_submodules='yes on-demand no' __git_format_patch_extra_options=$'\n\t--full-index --not --all --no-prefix --src-prefix=\n\t--dst-prefix= --notes\n' __git_log_common_options=$'\n\t--not --all\n\t--branches --tags --remotes\n\t--first-parent --merges --no-merges\n\t--max-count=\n\t--max-age= --since= --after=\n\t--min-age= --until= --before=\n\t--min-parents= --max-parents=\n\t--no-min-parents --no-max-parents\n' __git_log_date_formats='relative iso8601 iso8601-strict rfc2822 short local default raw unix format:' __git_log_gitk_options=$'\n\t--dense --sparse --full-history\n\t--simplify-merges --simplify-by-decoration\n\t--left-right --notes --no-notes\n' __git_log_pretty_formats='oneline short medium full fuller reference email raw format: tformat: mboxrd' __git_log_shortlog_options=$'\n\t--author= --committer= --grep=\n\t--all-match --invert-grep\n' __git_merge_strategies= __git_merge_strategy_options=$'ours theirs subtree subtree= patience\n\thistogram diff-algorithm= ignore-space-change ignore-all-space\n\tignore-space-at-eol renormalize no-renormalize no-renames\n\tfind-renames find-renames= rename-threshold=' __git_mergetools_common=$'diffuse diffmerge ecmerge emerge kdiff3 meld opendiff\n\t\t\ttkdiff vimdiff nvimdiff gvimdiff xxdiff araxis p4merge\n\t\t\tbc codecompare smerge\n' __git_patchformat='mbox stgit stgit-series hg mboxrd' __git_printf_supports_v=yes __git_push_recurse_submodules='check on-demand only' __git_rebase_inprogress_options='--continue --skip --abort --quit --show-current-patch' __git_rebase_interactive_inprogress_options='--continue --skip --abort --quit --show-current-patch --edit-todo' __git_ref_fieldlist='refname objecttype objectsize objectname upstream push HEAD symref' __git_revert_inprogress_options='--continue --quit --abort --skip' __git_send_email_confirm_options='always never auto cc compose' __git_send_email_suppresscc_options='author self cc bodycc sob cccmd body all' __git_sequencer_inprogress_options='--continue --quit --abort --skip' __git_showcurrentpatch='diff raw' __git_untracked_file_modes='all no normal' __git_whitespacelist='nowarn warn error error-all fix' _backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))' _xspecs=([tex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [freeamp]="!*.@(mp3|ogg|pls|m3u)" [gqmpeg]="!*.@(mp3|ogg|pls|m3u)" [texi2html]="!*.texi*" [hbpp]="!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])" [lowriter]="!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm|pdf)" [rpm2cpio]="!*.[rs]pm" [localc]="!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|?(f)ods|ots)" [hbrun]="!*.[Hh][Rr][Bb]" [vi]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [latex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [view]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [madplay]="!*.mp3" [compress]="*.Z" [pdfjadetex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [pbunzip2]="!*.?(t)bz?(2)" [lrunzip]="!*.lrz" [gunzip]="!*.@(Z|[gGd]z|t[ag]z)" [oowriter]="!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|?(f)odt|ott|odm|pdf)" [epiphany]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [acroread]="!*.[pf]df" [znew]="*.Z" [kwrite]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [xemacs]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [gview]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [lzfgrep]="!*.@(tlz|lzma)" [lzless]="!*.@(tlz|lzma)" [cdiff]="!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))" [zipinfo]="!*.@(zip|[aegjswx]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|epub|apk|aab|ipa|do[ct][xm]|p[op]t[mx]|xl[st][xm]|pyz|whl)" [pdflatex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [portecle]="!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath|pem|p10|csr|crl)|cacerts)" [modplugplay]="!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|oct|okt?(a)|p[st]m|s[3t]m|ult|umx|wav|xm)" [lokalize]="!*.po" [lbzcat]="!*.?(t)bz?(2)" [qiv]="!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|svg)" [totem]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [ps2pdfwr]="!*.@(?(e)ps|pdf)" [dvitype]="!*.dvi" [unpigz]="!*.@(Z|[gGdz]z|t[ag]z)" [mozilla]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [pdfunite]="!*.pdf" [gpdf]="!*.[pf]df" [texi2dvi]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [bunzip2]="!*.?(t)bz?(2)" [zathura]="!*.@(cb[rz7t]|djv?(u)|?(e)ps|pdf)" [kaffeine]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [mpg123]="!*.mp3" [lzegrep]="!*.@(tlz|lzma)" [xv]="!*.@(gif|jp?(e)g?(2)|j2[ck]|jp[2f]|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|?(e)ps)" [xdvi]="!*.@(dvi|DVI)?(.@(gz|Z|bz2))" [xfig]="!*.fig" [xpdf]="!*.[pf]df" [oobase]="!*.odb" [xelatex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [gharbour]="!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])" [bzcat]="!*.?(t)bz?(2)" [dragon]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [xanim]="!*.@(mpg|mpeg|avi|mov|qt)" [lualatex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [rgview]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [rvim]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [xetex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [lomath]="!*.@(sxm|smf|mml|odf)" [zcat]="!*.@(Z|[gGd]z|t[ag]z)" [lynx]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [uncompress]="!*.Z" [xzcat]="!*.@(?(t)xz|tlz|lzma)" [vim]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [loimpress]="!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|?(f)odp|otp)" [dvipdf]="!*.dvi" [mpg321]="!*.mp3" [jadetex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [lobase]="!*.odb" [epdfview]="!*.pdf" [ps2pdf14]="!*.@(?(e)ps|pdf)" [ps2pdf13]="!*.@(?(e)ps|pdf)" [ps2pdf12]="!*.@(?(e)ps|pdf)" [poedit]="!*.po" [luatex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [kbabel]="!*.po" [bzme]="!*.@(zip|z|gz|tgz)" [dviselect]="!*.dvi" [realplay]="!*.@(rm?(j)|ra?(m)|smi?(l))" [kdvi]="!*.@(dvi|DVI)?(.@(gz|Z|bz2))" [elinks]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [kghostview]="!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))" [gtranslator]="!*.po" [unzip]="!*.@(zip|[aegjswx]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|epub|apk|aab|ipa|do[ct][xm]|p[op]t[mx]|xl[st][xm]|pyz|whl)" [ggv]="!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))" [oomath]="!*.@(sxm|smf|mml|odf)" [dvipdfmx]="!*.dvi" [makeinfo]="!*.texi*" [okular]="!*.@(okular|@(?(e|x)ps|?(E|X)PS|[pf]df|[PF]DF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX|epub|EPUB|odt|ODT|fb?(2)|FB?(2)|mobi|MOBI|g3|G3|chm|CHM)?(.?(gz|GZ|bz2|BZ2|xz|XZ)))" [sxemacs]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [aviplay]="!*.@(avi|asf|wmv)" [rgvim]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [dvipdfm]="!*.dvi" [ly2dvi]="!*.ly" [oodraw]="!*.@(sxd|std|sda|sdd|?(f)odg|otg)" [kpdf]="!*.@(?(e)ps|pdf)" [bibtex]="!*.aux" [netscape]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [emacs]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [rview]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [galeon]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [dillo]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [fbxine]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [oocalc]="!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|?(f)ods|ots)" [harbour]="!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])" [lodraw]="!*.@(sxd|std|sda|sdd|?(f)odg|otg)" [dvips]="!*.dvi" [ps2pdf]="!*.@(?(e)ps|pdf)" [kate]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [kid3-qt]="!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)" [pdftex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [gvim]="*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)" [timidity]="!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)" [ogg123]="!*.@(og[ag]|m3u|flac|spx)" [lzgrep]="!*.@(tlz|lzma)" [ee]="!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)" [unlzma]="!*.@(tlz|lzma)" [lbunzip2]="!*.?(t)bz?(2)" [ooimpress]="!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|?(f)odp|otp)" [xine]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [amaya]="!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))" [gv]="!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))" [kid3]="!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)" [lilypond]="!*.ly" [modplug123]="!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|oct|okt?(a)|p[st]m|s[3t]m|ult|umx|wav|xm)" [pbzcat]="!*.?(t)bz?(2)" [unxz]="!*.@(?(t)xz|tlz|lzma)" [playmidi]="!*.@(mid?(i)|cmf)" [lzcat]="!*.@(tlz|lzma)" [slitex]="!*.@(?(la)tex|texi|dtx|ins|ltx|dbj)" [aaxine]="!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmv]|OG[AGMV]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))" [advi]="!*.dvi" [lzmore]="!*.@(tlz|lzma)" ) color=32m colorregex='3[12]m' common_options='-q --quiet -v --verbose --debug -h --help --urpmi-root --wait-lock' loginsh=1 new_dirs=/home/ftg/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share psclear=$'\E[0m' pscolor=$'\E[1;32m' psreset=$'\017\E[10;0m' python=/usr/share/man/man1/python.1.xz __expand_tilde_by_ref () { if [[ ${!1-} == \~* ]]; then eval $1="$(printf ~%q "${!1#\~}")"; fi } __get_cword_at_cursor_by_ref () { local cword words=(); __reassemble_comp_words_by_ref "$1" words cword; local i cur="" index=$COMP_POINT lead=${COMP_LINE:0:COMP_POINT}; if [[ $index -gt 0 && ( -n $lead && -n ${lead//[[:space:]]/} ) ]]; then cur=$COMP_LINE; for ((i = 0; i <= cword; ++i)) do while [[ ${#cur} -ge ${#words[i]} && ${cur:0:${#words[i]}} != "${words[i]-}" ]]; do cur="${cur:1}"; ((index > 0)) && ((index--)); done; if ((i < cword)); then local old_size=${#cur}; cur="${cur#"${words[i]}"}"; local new_size=${#cur}; ((index -= old_size - new_size)); fi; done; [[ -n $cur && ! -n ${cur//[[:space:]]/} ]] && cur=; ((index < 0)) && index=0; fi; local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 ${words+"${words[@]}"} -v $3 "$cword" -v $4 "${cur:0:index}" } __git () { git ${__git_C_args:+"${__git_C_args[@]}"} ${__git_dir:+--git-dir="$__git_dir"} "$@" 2> /dev/null } __git_aliased_command () { local cur=$1 last list word cmdline; while [[ -n "$cur" ]]; do if [[ "$list" == *" $cur "* ]]; then return; fi; cmdline=$(__git config --get "alias.$cur"); list=" $cur $list"; last=$cur; cur=; for word in $cmdline; do case "$word" in \!gitk | gitk) cur="gitk"; break ;; \!*) : shell command alias ;; -*) : option ;; *=*) : setting env ;; git) : git itself ;; \(\)) : skip parens of shell function definition ;; {) : skip start of shell helper function ;; :) : skip null command ;; \'*) : skip opening quote after sh -c ;; *) cur="$word"; break ;; esac; done; done; cur=$last; if [[ "$cur" != "$1" ]]; then echo "$cur"; fi } __git_checkout_default_dwim_mode () { local last_option dwim_opt="--dwim"; if [ "${GIT_COMPLETION_CHECKOUT_NO_GUESS-}" = "1" ]; then dwim_opt=""; fi; if [ -n "$(__git_find_on_cmdline "--no-track")" ]; then dwim_opt=""; fi; if [ "$(__git config --type=bool checkout.guess)" = "false" ]; then dwim_opt=""; fi; last_option="$(__git_find_last_on_cmdline "--guess --no-guess")"; case "$last_option" in --guess) dwim_opt="--dwim" ;; --no-guess) dwim_opt="" ;; esac; echo "$dwim_opt" } __git_complete () { local wrapper="__git_wrap${2}"; eval "$wrapper () { __git_func_wrap $2 ; }"; complete -o bashdefault -o default -o nospace -F $wrapper $1 2> /dev/null || complete -o default -o nospace -F $wrapper $1 } __git_complete_command () { local command="$1"; local completion_func="_git_${command//-/_}"; if ! declare -f $completion_func > /dev/null 2> /dev/null && declare -f _completion_loader > /dev/null 2> /dev/null; then _completion_loader "git-$command"; fi; if declare -f $completion_func > /dev/null 2> /dev/null; then $completion_func; return 0; else if __git_support_parseopt_helper "$command"; then __git_complete_common "$command"; return 0; else return 1; fi; fi } __git_complete_common () { local command="$1"; case "$cur" in --*) __gitcomp_builtin "$command" ;; esac } __git_complete_config_variable_name () { local cur_="$cur" sfx; while test $# != 0; do case "$1" in --cur=*) cur_="${1##--cur=}" ;; --sfx=*) sfx="${1##--sfx=}" ;; *) return 1 ;; esac; shift; done; case "$cur_" in branch.*.*) local pfx="${cur_%.*}."; cur_="${cur_##*.}"; __gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_" "$sfx"; return ;; branch.*) local pfx="${cur%.*}."; cur_="${cur#*.}"; __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"; __gitcomp_nl_append 'autoSetupMerge autoSetupRebase ' "$pfx" "$cur_" "$sfx"; return ;; guitool.*.*) local pfx="${cur_%.*}."; cur_="${cur_##*.}"; __gitcomp " argPrompt cmd confirm needsFile noConsole noRescan prompt revPrompt revUnmerged title " "$pfx" "$cur_" "$sfx"; return ;; difftool.*.*) local pfx="${cur_%.*}."; cur_="${cur_##*.}"; __gitcomp "cmd path" "$pfx" "$cur_" "$sfx"; return ;; man.*.*) local pfx="${cur_%.*}."; cur_="${cur_##*.}"; __gitcomp "cmd path" "$pfx" "$cur_" "$sfx"; return ;; mergetool.*.*) local pfx="${cur_%.*}."; cur_="${cur_##*.}"; __gitcomp "cmd path trustExitCode" "$pfx" "$cur_" "$sfx"; return ;; pager.*) local pfx="${cur_%.*}."; cur_="${cur_#*.}"; __git_compute_all_commands; __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "$sfx"; return ;; remote.*.*) local pfx="${cur_%.*}."; cur_="${cur_##*.}"; __gitcomp " url proxy fetch push mirror skipDefaultUpdate receivepack uploadpack tagOpt pushurl " "$pfx" "$cur_" "$sfx"; return ;; remote.*) local pfx="${cur_%.*}."; cur_="${cur_#*.}"; __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."; __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "$sfx"; return ;; url.*.*) local pfx="${cur_%.*}."; cur_="${cur_##*.}"; __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" "$sfx"; return ;; *.*) __git_compute_config_vars; __gitcomp "$__git_config_vars" "" "$cur_" "$sfx" ;; *) __git_compute_config_vars; __gitcomp "$(echo "$__git_config_vars" | awk -F . '{ sections[$1] = 1 } END { for (s in sections) print s "." } ')" "" "$cur_" ;; esac } __git_complete_config_variable_name_and_value () { local cur_="$cur"; while test $# != 0; do case "$1" in --cur=*) cur_="${1##--cur=}" ;; *) return 1 ;; esac; shift; done; case "$cur_" in *=*) __git_complete_config_variable_value --varname="${cur_%%=*}" --cur="${cur_#*=}" ;; *) __git_complete_config_variable_name --cur="$cur_" --sfx='=' ;; esac } __git_complete_config_variable_value () { local varname="$prev" cur_="$cur"; while test $# != 0; do case "$1" in --varname=*) varname="${1##--varname=}" ;; --cur=*) cur_="${1##--cur=}" ;; *) return 1 ;; esac; shift; done; if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then varname="${varname,,}"; else varname="$(echo "$varname" |tr A-Z a-z)"; fi; case "$varname" in branch.*.remote | branch.*.pushremote) __gitcomp_nl "$(__git_remotes)" "" "$cur_"; return ;; branch.*.merge) __git_complete_refs --cur="$cur_"; return ;; branch.*.rebase) __gitcomp "false true merges preserve interactive" "" "$cur_"; return ;; remote.pushdefault) __gitcomp_nl "$(__git_remotes)" "" "$cur_"; return ;; remote.*.fetch) local remote="${varname#remote.}"; remote="${remote%.fetch}"; if [ -z "$cur_" ]; then __gitcomp_nl "refs/heads/" "" "" ""; return; fi; __gitcomp_nl "$(__git_refs_remotes "$remote")" "" "$cur_"; return ;; remote.*.push) local remote="${varname#remote.}"; remote="${remote%.push}"; __gitcomp_nl "$(__git for-each-ref --format='%(refname):%(refname)' refs/heads)" "" "$cur_"; return ;; pull.twohead | pull.octopus) __git_compute_merge_strategies; __gitcomp "$__git_merge_strategies" "" "$cur_"; return ;; color.pager) __gitcomp "false true" "" "$cur_"; return ;; color.*.*) __gitcomp " normal black red green yellow blue magenta cyan white bold dim ul blink reverse " "" "$cur_"; return ;; color.*) __gitcomp "false true always never auto" "" "$cur_"; return ;; diff.submodule) __gitcomp "$__git_diff_submodule_formats" "" "$cur_"; return ;; help.format) __gitcomp "man info web html" "" "$cur_"; return ;; log.date) __gitcomp "$__git_log_date_formats" "" "$cur_"; return ;; sendemail.aliasfiletype) __gitcomp "mutt mailrc pine elm gnus" "" "$cur_"; return ;; sendemail.confirm) __gitcomp "$__git_send_email_confirm_options" "" "$cur_"; return ;; sendemail.suppresscc) __gitcomp "$__git_send_email_suppresscc_options" "" "$cur_"; return ;; sendemail.transferencoding) __gitcomp "7bit 8bit quoted-printable base64" "" "$cur_"; return ;; *.*) return ;; esac } __git_complete_fetch_refspecs () { local i remote="$1" pfx="${2-}" cur_="${3-$cur}" sfx="${4- }"; __gitcomp_direct "$( for i in $(__git_refs "$remote" "" "" "$cur_") ; do echo "$pfx$i:$i$sfx" done )" } __git_complete_file () { __git_complete_revlist_file } __git_complete_force_with_lease () { local cur_=$1; case "$cur_" in --*=) ;; *:*) __git_complete_refs --cur="${cur_#*:}" ;; *) __git_complete_refs --cur="$cur_" ;; esac } __git_complete_index_file () { local dequoted_word pfx="" cur_; __git_dequote "$cur"; case "$dequoted_word" in ?*/*) pfx="${dequoted_word%/*}/"; cur_="${dequoted_word##*/}" ;; *) cur_="$dequoted_word" ;; esac; __gitcomp_file_direct "$(__git_index_files "$1" "$pfx" "$cur_")" } __git_complete_refs () { local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs"; while test $# != 0; do case "$1" in --remote=*) remote="${1##--remote=}" ;; --dwim) dwim="yes" ;; --track) dwim="yes" ;; --pfx=*) pfx="${1##--pfx=}" ;; --cur=*) cur_="${1##--cur=}" ;; --sfx=*) sfx="${1##--sfx=}" ;; --mode=*) mode="${1##--mode=}" ;; *) return 1 ;; esac; shift; done; case "$mode" in refs) __gitcomp_direct "$(__git_refs "$remote" "" "$pfx" "$cur_" "$sfx")" ;; heads) __gitcomp_direct "$(__git_heads "$pfx" "$cur_" "$sfx")" ;; remote-heads) __gitcomp_direct "$(__git_remote_heads "$pfx" "$cur_" "$sfx")" ;; *) return 1 ;; esac; if [ "$dwim" = "yes" ]; then __gitcomp_direct_append "$(__git_dwim_remote_heads "$pfx" "$cur_" "$sfx")"; fi } __git_complete_remote_or_refspec () { local cur_="$cur" cmd="${words[1]}"; local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0; if [ "$cmd" = "remote" ]; then ((c++)); fi; while [ $c -lt $cword ]; do i="${words[c]}"; case "$i" in --mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; -d | --delete) [ "$cmd" = "push" ] && lhs=0 ;; --all) case "$cmd" in push) no_complete_refspec=1 ;; fetch) return ;; *) ;; esac ;; --multiple) no_complete_refspec=1; break ;; -*) ;; *) remote="$i"; break ;; esac; ((c++)); done; if [ -z "$remote" ]; then __gitcomp_nl "$(__git_remotes)"; return; fi; if [ $no_complete_refspec = 1 ]; then return; fi; [ "$remote" = "." ] && remote=; case "$cur_" in *:*) case "$COMP_WORDBREAKS" in *:*) : great ;; *) pfx="${cur_%%:*}:" ;; esac; cur_="${cur_#*:}"; lhs=0 ;; +*) pfx="+"; cur_="${cur_#+}" ;; esac; case "$cmd" in fetch) if [ $lhs = 1 ]; then __git_complete_fetch_refspecs "$remote" "$pfx" "$cur_"; else __git_complete_refs --pfx="$pfx" --cur="$cur_"; fi ;; pull | remote) if [ $lhs = 1 ]; then __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"; else __git_complete_refs --pfx="$pfx" --cur="$cur_"; fi ;; push) if [ $lhs = 1 ]; then __git_complete_refs --pfx="$pfx" --cur="$cur_"; else __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"; fi ;; esac } __git_complete_revlist () { __git_complete_revlist_file } __git_complete_revlist_file () { local dequoted_word pfx ls ref cur_="$cur"; case "$cur_" in *..?*:*) return ;; ?*:*) ref="${cur_%%:*}"; cur_="${cur_#*:}"; __git_dequote "$cur_"; case "$dequoted_word" in ?*/*) pfx="${dequoted_word%/*}"; cur_="${dequoted_word##*/}"; ls="$ref:$pfx"; pfx="$pfx/" ;; *) cur_="$dequoted_word"; ls="$ref" ;; esac; case "$COMP_WORDBREAKS" in *:*) : great ;; *) pfx="$ref:$pfx" ;; esac; __gitcomp_file "$(__git ls-tree "$ls" | sed 's/^.* // s/$//')" "$pfx" "$cur_" ;; *...*) pfx="${cur_%...*}..."; cur_="${cur_#*...}"; __git_complete_refs --pfx="$pfx" --cur="$cur_" ;; *..*) pfx="${cur_%..*}.."; cur_="${cur_#*..}"; __git_complete_refs --pfx="$pfx" --cur="$cur_" ;; *) __git_complete_refs ;; esac } __git_complete_strategy () { __git_compute_merge_strategies; case "$prev" in -s | --strategy) __gitcomp "$__git_merge_strategies"; return 0 ;; -X) __gitcomp "$__git_merge_strategy_options"; return 0 ;; esac; case "$cur" in --strategy=*) __gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}"; return 0 ;; --strategy-option=*) __gitcomp "$__git_merge_strategy_options" "" "${cur##--strategy-option=}"; return 0 ;; esac; return 1 } __git_complete_symbol () { local tags=tags pfx="" cur_="${cur-}" sfx=" "; while test $# != 0; do case "$1" in --tags=*) tags="${1##--tags=}" ;; --pfx=*) pfx="${1##--pfx=}" ;; --cur=*) cur_="${1##--cur=}" ;; --sfx=*) sfx="${1##--sfx=}" ;; *) return 1 ;; esac; shift; done; if test -r "$tags"; then __gitcomp_direct "$(__git_match_ctag "$cur_" "$tags" "$pfx" "$sfx")"; fi } __git_complete_worktree_paths () { local IFS=' '; __gitcomp_nl "$(git worktree list --porcelain | # Skip the first entry: it's the path of the main worktree, # which can't be moved, removed, locked, etc. sed -n -e '2,$ s/^worktree //p')" } __git_compute_all_commands () { test -n "$__git_all_commands" || __git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers) } __git_compute_config_vars () { test -n "$__git_config_vars" || __git_config_vars="$(git help --config-for-completion | sort -u)" } __git_compute_merge_strategies () { test -n "$__git_merge_strategies" || __git_merge_strategies=$(__git_list_merge_strategies) } __git_config_get_set_variables () { local prevword word config_file= c=$cword; while [ $c -gt 1 ]; do word="${words[c]}"; case "$word" in --system | --global | --local | --file=*) config_file="$word"; break ;; -f | --file) config_file="$word $prevword"; break ;; esac; prevword=$word; c=$((--c)); done; __git config $config_file --name-only --list } __git_count_arguments () { local word i c=0; for ((i=1; i < ${#words[@]}; i++)) do word="${words[i]}"; case "$word" in --) ((c = 0)) ;; "$1") ((c = 0)) ;; ?*) ((c++)) ;; esac; done; printf "%d" $c } __git_dequote () { local rest="$1" len ch; dequoted_word=""; while test -n "$rest"; do len=${#dequoted_word}; dequoted_word="$dequoted_word${rest%%[\\\'\"]*}"; rest="${rest:$((${#dequoted_word}-$len))}"; case "${rest:0:1}" in \\) ch="${rest:1:1}"; case "$ch" in ' ') ;; *) dequoted_word="$dequoted_word$ch" ;; esac; rest="${rest:2}" ;; \') rest="${rest:1}"; len=${#dequoted_word}; dequoted_word="$dequoted_word${rest%%\'*}"; rest="${rest:$((${#dequoted_word}-$len+1))}" ;; \") rest="${rest:1}"; while test -n "$rest"; do len=${#dequoted_word}; dequoted_word="$dequoted_word${rest%%[\\\"]*}"; rest="${rest:$((${#dequoted_word}-$len))}"; case "${rest:0:1}" in \\) ch="${rest:1:1}"; case "$ch" in \" | \\ | \$ | \`) dequoted_word="$dequoted_word$ch" ;; ' ') ;; *) dequoted_word="$dequoted_word\\$ch" ;; esac; rest="${rest:2}" ;; \") rest="${rest:1}"; break ;; esac; done ;; esac; done } __git_dwim_remote_heads () { local pfx="${1-}" cur_="${2-}" sfx="${3-}"; local fer_pfx="${pfx//\%/%%}"; __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" --sort="refname:strip=3" "refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | uniq -u } __git_eread () { test -r "$1" && IFS=' ' read "$2" < "$1" } __git_find_last_on_cmdline () { local word c=$cword show_idx; while test $# -gt 1; do case "$1" in --show-idx) show_idx=y ;; *) return 1 ;; esac; shift; done; local wordlist="$1"; while [ $c -gt 1 ]; do ((c--)); for word in $wordlist; do if [ "$word" = "${words[c]}" ]; then if [ -n "$show_idx" ]; then echo "$c $word"; else echo "$word"; fi; return; fi; done; done } __git_find_on_cmdline () { local word c=1 show_idx; while test $# -gt 1; do case "$1" in --show-idx) show_idx=y ;; *) return 1 ;; esac; shift; done; local wordlist="$1"; while [ $c -lt $cword ]; do for word in $wordlist; do if [ "$word" = "${words[c]}" ]; then if [ -n "${show_idx-}" ]; then echo "$c $word"; else echo "$word"; fi; return; fi; done; ((c++)); done } __git_find_repo_path () { if [ -n "${__git_repo_path-}" ]; then return; fi; if [ -n "${__git_C_args-}" ]; then __git_repo_path="$(git "${__git_C_args[@]}" ${__git_dir:+--git-dir="$__git_dir"} rev-parse --absolute-git-dir 2>/dev/null)"; else if [ -n "${__git_dir-}" ]; then test -d "$__git_dir" && __git_repo_path="$__git_dir"; else if [ -n "${GIT_DIR-}" ]; then test -d "${GIT_DIR-}" && __git_repo_path="$GIT_DIR"; else if [ -d .git ]; then __git_repo_path=.git; else __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)"; fi; fi; fi; fi } __git_func_wrap () { local cur words cword prev; _get_comp_words_by_ref -n =: cur words cword prev; $1 } __git_get_config_variables () { local section="$1" i IFS=' '; for i in $(__git config --name-only --get-regexp "^$section\..*"); do echo "${i#$section.}"; done } __git_get_option_value () { local c short_opt long_opt val; local result= values config_key word; short_opt="$1"; long_opt="$2"; values="$3"; config_key="$4"; ((c = $cword - 1)); while [ $c -ge 0 ]; do word="${words[c]}"; for val in $values; do if [ "$short_opt$val" = "$word" ] || [ "$long_opt$val" = "$word" ]; then result="$val"; break 2; fi; done; ((c--)); done; if [ -n "$config_key" ] && [ -z "$result" ]; then result="$(__git config "$config_key")"; fi; echo "$result" } __git_has_doubledash () { local c=1; while [ $c -lt $cword ]; do if [ "--" = "${words[c]}" ]; then return 0; fi; ((c++)); done; return 1 } __git_heads () { local pfx="${1-}" cur_="${2-}" sfx="${3-}"; __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" "refs/heads/$cur_*" "refs/heads/$cur_*/**" } __git_index_files () { local root="$2" match="$3"; __git_ls_files_helper "$root" "$1" "${match:-?}" | awk -F / -v pfx="${2//\\/\\\\}" '{ paths[$1] = 1 } END { for (p in paths) { if (substr(p, 1, 1) != "\"") { # No special characters, easy! print pfx p continue } # The path is quoted. p = dequote(p) if (p == "") continue # Even when a directory name itself does not contain # any special characters, it will still be quoted if # any of its (stripped) trailing path components do. # Because of this we may have seen the same directory # both quoted and unquoted. if (p in paths) # We have seen the same directory unquoted, # skip it. continue else print pfx p } } function dequote(p, bs_idx, out, esc, esc_idx, dec) { # Skip opening double quote. p = substr(p, 2) # Interpret backslash escape sequences. while ((bs_idx = index(p, "\\")) != 0) { out = out substr(p, 1, bs_idx - 1) esc = substr(p, bs_idx + 1, 1) p = substr(p, bs_idx + 2) if ((esc_idx = index("abtvfr\"\\", esc)) != 0) { # C-style one-character escape sequence. out = out substr("\a\b\t\v\f\r\"\\", esc_idx, 1) } else if (esc == "n") { # Uh-oh, a newline character. # We cannot reliably put a pathname # containing a newline into COMPREPLY, # and the newline would create a mess. # Skip this path. return "" } else { # Must be a \nnn octal value, then. dec = esc * 64 + \ substr(p, 1, 1) * 8 + \ substr(p, 2, 1) out = out sprintf("%c", dec) p = substr(p, 3) } } # Drop closing double quote, if there is one. # (There is not any if this is a directory, as it was # already stripped with the trailing path components.) if (substr(p, length(p), 1) == "\"") out = out substr(p, 1, length(p) - 1) else out = out p return out }' } __git_is_configured_remote () { local remote; for remote in $(__git_remotes); do if [ "$remote" = "$1" ]; then return 0; fi; done; return 1 } __git_list_merge_strategies () { LANG=C LC_ALL=C git merge -s help 2>&1 | sed -n -e '/[Aa]vailable strategies are: /,/^$/{ s/\.$// s/.*:// s/^[ ]*// s/[ ]*$// p }' } __git_ls_files_helper () { if [ "$2" == "--committable" ]; then __git -C "$1" -c core.quotePath=false diff-index --name-only --relative HEAD -- "${3//\\/\\\\}*"; else __git -C "$1" -c core.quotePath=false ls-files --exclude-standard $2 -- "${3//\\/\\\\}*"; fi } __git_main () { local i c=1 command __git_dir __git_repo_path; local __git_C_args C_args_count=0; while [ $c -lt $cword ]; do i="${words[c]}"; case "$i" in --git-dir=*) __git_dir="${i#--git-dir=}" ;; --git-dir) ((c++)); __git_dir="${words[c]}" ;; --bare) __git_dir="." ;; --help) command="help"; break ;; -c | --work-tree | --namespace) ((c++)) ;; -C) __git_C_args[C_args_count++]=-C; ((c++)); __git_C_args[C_args_count++]="${words[c]}" ;; -*) ;; *) command="$i"; break ;; esac; ((c++)); done; if [ -z "${command-}" ]; then case "$prev" in --git-dir | -C | --work-tree) return ;; -c) __git_complete_config_variable_name_and_value; return ;; --namespace) return ;; esac; case "$cur" in --*) __gitcomp " --paginate --no-pager --git-dir= --bare --version --exec-path --exec-path= --html-path --man-path --info-path --work-tree= --namespace= --no-replace-objects --help " ;; *) if test -n "${GIT_TESTING_PORCELAIN_COMMAND_LIST-}"; then __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"; else __gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)"; fi ;; esac; return; fi; __git_complete_command "$command" && return; local expansion=$(__git_aliased_command "$command"); if [ -n "$expansion" ]; then words[1]=$expansion; __git_complete_command "$expansion"; fi } __git_match_ctag () { awk -v pfx="${3-}" -v sfx="${4-}" " /^${1//\//\\/}/ { print pfx \$1 sfx } " "$2" } __git_pretty_aliases () { __git_get_config_variables "pretty" } __git_ps1 () { local exit=$?; local pcmode=no; local detached=no; local ps1pc_start='\u@\h:\w '; local ps1pc_end='\$ '; local printf_format=' (%s)'; case "$#" in 2 | 3) pcmode=yes; ps1pc_start="$1"; ps1pc_end="$2"; printf_format="${3:-$printf_format}"; PS1="$ps1pc_start$ps1pc_end" ;; 0 | 1) printf_format="${1:-$printf_format}" ;; *) return $exit ;; esac; local ps1_expanded=yes; [ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no; [ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no; local repo_info rev_parse_exit_code; repo_info="$(git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD 2>/dev/null)"; rev_parse_exit_code="$?"; if [ -z "$repo_info" ]; then return $exit; fi; local short_sha=""; if [ "$rev_parse_exit_code" = "0" ]; then short_sha="${repo_info##* }"; repo_info="${repo_info% *}"; fi; local inside_worktree="${repo_info##* }"; repo_info="${repo_info% *}"; local bare_repo="${repo_info##* }"; repo_info="${repo_info% *}"; local inside_gitdir="${repo_info##* }"; local g="${repo_info% *}"; if [ "true" = "$inside_worktree" ] && [ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] && [ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] && git check-ignore -q .; then return $exit; fi; local sparse=""; if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] && [ -z "${GIT_PS1_OMITSPARSESTATE}" ] && [ "$(git config --bool core.sparseCheckout)" = "true" ]; then sparse="|SPARSE"; fi; local r=""; local b=""; local step=""; local total=""; if [ -d "$g/rebase-merge" ]; then __git_eread "$g/rebase-merge/head-name" b; __git_eread "$g/rebase-merge/msgnum" step; __git_eread "$g/rebase-merge/end" total; r="|REBASE"; else if [ -d "$g/rebase-apply" ]; then __git_eread "$g/rebase-apply/next" step; __git_eread "$g/rebase-apply/last" total; if [ -f "$g/rebase-apply/rebasing" ]; then __git_eread "$g/rebase-apply/head-name" b; r="|REBASE"; else if [ -f "$g/rebase-apply/applying" ]; then r="|AM"; else r="|AM/REBASE"; fi; fi; else if [ -f "$g/MERGE_HEAD" ]; then r="|MERGING"; else if __git_sequencer_status; then :; else if [ -f "$g/BISECT_LOG" ]; then r="|BISECTING"; fi; fi; fi; fi; if [ -n "$b" ]; then :; else if [ -h "$g/HEAD" ]; then b="$(git symbolic-ref HEAD 2>/dev/null)"; else local head=""; if ! __git_eread "$g/HEAD" head; then return $exit; fi; b="${head#ref: }"; if [ "$head" = "$b" ]; then detached=yes; b="$( case "${GIT_PS1_DESCRIBE_STYLE-}" in (contains) git describe --contains HEAD ;; (branch) git describe --contains --all HEAD ;; (tag) git describe --tags HEAD ;; (describe) git describe HEAD ;; (* | default) git describe --tags --exact-match HEAD ;; esac 2>/dev/null)" || b="$short_sha..."; b="($b)"; fi; fi; fi; fi; if [ -n "$step" ] && [ -n "$total" ]; then r="$r $step/$total"; fi; local w=""; local i=""; local s=""; local u=""; local h=""; local c=""; local p=""; if [ "true" = "$inside_gitdir" ]; then if [ "true" = "$bare_repo" ]; then c="BARE:"; else b="GIT_DIR!"; fi; else if [ "true" = "$inside_worktree" ]; then if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] && [ "$(git config --bool bash.showDirtyState)" != "false" ]; then git diff --no-ext-diff --quiet || w="*"; git diff --no-ext-diff --cached --quiet || i="+"; if [ -z "$short_sha" ] && [ -z "$i" ]; then i="#"; fi; fi; if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] && git rev-parse --verify --quiet refs/stash > /dev/null; then s="$"; fi; if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] && [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] && git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' > /dev/null 2> /dev/null; then u="%${ZSH_VERSION+%}"; fi; if [ -n "${GIT_PS1_COMPRESSSPARSESTATE}" ] && [ "$(git config --bool core.sparseCheckout)" = "true" ]; then h="?"; fi; if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then __git_ps1_show_upstream; fi; fi; fi; local z="${GIT_PS1_STATESEPARATOR-" "}"; if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then __git_ps1_colorize_gitstring; fi; fi; b=${b##refs/heads/}; if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then __git_ps1_branch_name=$b; b="\${__git_ps1_branch_name}"; fi; local f="$h$w$i$s$u"; local gitstring="$c$b${f:+$z$f}${sparse}$r$p"; if [ $pcmode = yes ]; then if [ "${__git_printf_supports_v-}" != yes ]; then gitstring=$(printf -- "$printf_format" "$gitstring"); else printf -v gitstring -- "$printf_format" "$gitstring"; fi; PS1="$ps1pc_start$gitstring$ps1pc_end"; else printf -- "$printf_format" "$gitstring"; fi; return $exit } __git_ps1_colorize_gitstring () { if [[ -n ${ZSH_VERSION-} ]]; then local c_red='%F{red}'; local c_green='%F{green}'; local c_lblue='%F{blue}'; local c_clear='%f'; else local c_red='\[\e[31m\]'; local c_green='\[\e[32m\]'; local c_lblue='\[\e[1;34m\]'; local c_clear='\[\e[0m\]'; fi; local bad_color=$c_red; local ok_color=$c_green; local flags_color="$c_lblue"; local branch_color=""; if [ $detached = no ]; then branch_color="$ok_color"; else branch_color="$bad_color"; fi; c="$branch_color$c"; z="$c_clear$z"; if [ "$w" = "*" ]; then w="$bad_color$w"; fi; if [ -n "$i" ]; then i="$ok_color$i"; fi; if [ -n "$s" ]; then s="$flags_color$s"; fi; if [ -n "$u" ]; then u="$bad_color$u"; fi; r="$c_clear$r" } __git_ps1_show_upstream () { local key value; local svn_remote svn_url_pattern count n; local upstream=git legacy="" verbose="" name=""; svn_remote=(); local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"; while read -r key value; do case "$key" in bash.showupstream) GIT_PS1_SHOWUPSTREAM="$value"; if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then p=""; return; fi ;; svn-remote.*.url) svn_remote[$((${#svn_remote[@]} + 1))]="$value"; svn_url_pattern="$svn_url_pattern\\|$value"; upstream=svn+git ;; esac; done <<< "$output"; local option; for option in ${GIT_PS1_SHOWUPSTREAM}; do case "$option" in git | svn) upstream="$option" ;; verbose) verbose=1 ;; legacy) legacy=1 ;; name) name=1 ;; esac; done; case "$upstream" in git) upstream="@{upstream}" ;; svn*) local -a svn_upstream; svn_upstream=($(git log --first-parent -1 --grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null)); if [[ 0 -ne ${#svn_upstream[@]} ]]; then svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]}; svn_upstream=${svn_upstream%@*}; local n_stop="${#svn_remote[@]}"; for ((n=1; n <= n_stop; n++)) do svn_upstream=${svn_upstream#${svn_remote[$n]}}; done; if [[ -z "$svn_upstream" ]]; then upstream=${GIT_SVN_ID:-git-svn}; else upstream=${svn_upstream#/}; fi; else if [[ "svn+git" = "$upstream" ]]; then upstream="@{upstream}"; fi; fi ;; esac; if [[ -z "$legacy" ]]; then count="$(git rev-list --count --left-right "$upstream"...HEAD 2>/dev/null)"; else local commits; if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"; then local commit behind=0 ahead=0; for commit in $commits; do case "$commit" in "<"*) ((behind++)) ;; *) ((ahead++)) ;; esac; done; count="$behind $ahead"; else count=""; fi; fi; if [[ -z "$verbose" ]]; then case "$count" in "") p="" ;; "0 0") p="=" ;; "0 "*) p=">" ;; *" 0") p="<" ;; *) p="<>" ;; esac; else case "$count" in "") p="" ;; "0 0") p=" u=" ;; "0 "*) p=" u+${count#0 }" ;; *" 0") p=" u-${count% 0}" ;; *) p=" u+${count#* }-${count% *}" ;; esac; if [[ -n "$count" && -n "$name" ]]; then __git_ps1_upstream_name=$(git rev-parse --abbrev-ref "$upstream" 2>/dev/null); if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then p="$p \${__git_ps1_upstream_name}"; else p="$p ${__git_ps1_upstream_name}"; unset __git_ps1_upstream_name; fi; fi; fi } __git_reassemble_comp_words_by_ref () { local exclude i j first; exclude="${1//[^$COMP_WORDBREAKS]}"; cword_=$COMP_CWORD; if [ -z "$exclude" ]; then words_=("${COMP_WORDS[@]}"); return; fi; for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)) do first=t; while [ $i -gt 0 ] && [ -n "${COMP_WORDS[$i]}" ] && [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ]; do if [ $j -ge 2 ] && [ -n "$first" ]; then ((j--)); fi; first=; words_[$j]=${words_[j]}${COMP_WORDS[i]}; if [ $i = $COMP_CWORD ]; then cword_=$j; fi; if (($i < ${#COMP_WORDS[@]} - 1)); then ((i++)); else return; fi; done; words_[$j]=${words_[j]}${COMP_WORDS[i]}; if [ $i = $COMP_CWORD ]; then cword_=$j; fi; done } __git_refs () { local i hash dir track="${2-}"; local list_refs_from=path remote="${1-}"; local format refs; local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"; local match="${4-}"; local fer_pfx="${pfx//\%/%%}"; __git_find_repo_path; dir="$__git_repo_path"; if [ -z "$remote" ]; then if [ -z "$dir" ]; then return; fi; else if __git_is_configured_remote "$remote"; then list_refs_from=remote; else if [ -d "$remote/.git" ]; then dir="$remote/.git"; else if [ -d "$remote" ]; then dir="$remote"; else list_refs_from=url; fi; fi; fi; fi; if [ "$list_refs_from" = path ]; then if [[ "$cur_" == ^* ]]; then pfx="$pfx^"; fer_pfx="$fer_pfx^"; cur_=${cur_#^}; match=${match#^}; fi; case "$cur_" in refs | refs/*) format="refname"; refs=("$match*" "$match*/**"); track="" ;; *) for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD; do case "$i" in $match*) if [ -e "$dir/$i" ]; then echo "$pfx$i$sfx"; fi ;; esac; done; format="refname:strip=2"; refs=("refs/tags/$match*" "refs/tags/$match*/**" "refs/heads/$match*" "refs/heads/$match*/**" "refs/remotes/$match*" "refs/remotes/$match*/**") ;; esac; __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" "${refs[@]}"; if [ -n "$track" ]; then __git_dwim_remote_heads "$pfx" "$match" "$sfx"; fi; return; fi; case "$cur_" in refs | refs/*) __git ls-remote "$remote" "$match*" | while read -r hash i; do case "$i" in *^{}) ;; *) echo "$pfx$i$sfx" ;; esac; done ;; *) if [ "$list_refs_from" = remote ]; then case "HEAD" in $match*) echo "${pfx}HEAD$sfx" ;; esac; __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" "refs/remotes/$remote/$match*" "refs/remotes/$remote/$match*/**"; else local query_symref; case "HEAD" in $match*) query_symref="HEAD" ;; esac; __git ls-remote "$remote" $query_symref "refs/tags/$match*" "refs/heads/$match*" "refs/remotes/$match*" | while read -r hash i; do case "$i" in *^{}) ;; refs/*) echo "$pfx${i#refs/*/}$sfx" ;; *) echo "$pfx$i$sfx" ;; esac; done; fi ;; esac } __git_refs2 () { local i; for i in $(__git_refs "$1"); do echo "$i:$i"; done } __git_refs_remotes () { local i hash; __git ls-remote "$1" 'refs/heads/*' | while read -r hash i; do echo "$i:refs/remotes/$1/${i#refs/heads/}"; done } __git_remote_heads () { local pfx="${1-}" cur_="${2-}" sfx="${3-}"; __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" "refs/remotes/$cur_*" "refs/remotes/$cur_*/**" } __git_remotes () { __git_find_repo_path; test -d "$__git_repo_path/remotes" && ls -1 "$__git_repo_path/remotes"; __git remote } __git_sequencer_status () { local todo; if test -f "$g/CHERRY_PICK_HEAD"; then r="|CHERRY-PICKING"; return 0; else if test -f "$g/REVERT_HEAD"; then r="|REVERTING"; return 0; else if __git_eread "$g/sequencer/todo" todo; then case "$todo" in p[\ \ ] | pick[\ \ ]*) r="|CHERRY-PICKING"; return 0 ;; revert[\ \ ]*) r="|REVERTING"; return 0 ;; esac; fi; fi; fi; return 1 } __git_support_parseopt_helper () { test -n "$__git_cmds_with_parseopt_helper" || __git_cmds_with_parseopt_helper="$(__git --list-cmds=parseopt)"; case " $__git_cmds_with_parseopt_helper " in *" $1 "*) return 0 ;; *) return 1 ;; esac } __git_tags () { local pfx="${1-}" cur_="${2-}" sfx="${3-}"; __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" "refs/tags/$cur_*" "refs/tags/$cur_*/**" } __git_wrap__git_main () { __git_func_wrap __git_main } __git_wrap__gitk_main () { __git_func_wrap __gitk_main } __gitcomp () { local cur_="${3-$cur}"; case "$cur_" in --*=) ;; --no-*) local c i=0 IFS=' '; for c in $1; do if [[ $c == "--" ]]; then continue; fi; c="$c${4-}"; if [[ $c == "$cur_"* ]]; then case $c in --*= | *.) ;; *) c="$c " ;; esac; COMPREPLY[i++]="${2-}$c"; fi; done ;; *) local c i=0 IFS=' '; for c in $1; do if [[ $c == "--" ]]; then c="--no-...${4-}"; if [[ $c == "$cur_"* ]]; then COMPREPLY[i++]="${2-}$c "; fi; break; fi; c="$c${4-}"; if [[ $c == "$cur_"* ]]; then case $c in *= | *.) ;; *) c="$c " ;; esac; COMPREPLY[i++]="${2-}$c"; fi; done ;; esac } __gitcomp_builtin () { local cmd="$1"; local incl="${2-}"; local excl="${3-}"; local var=__gitcomp_builtin_"${cmd/-/_}"; local options; eval "options=\${$var-}"; if [ -z "$options" ]; then local completion_helper; if [ "$GIT_COMPLETION_SHOW_ALL" = "1" ]; then completion_helper="--git-completion-helper-all"; else completion_helper="--git-completion-helper"; fi; options=" $incl $(__git ${cmd/_/ } $completion_helper) " || return; for i in $excl; do options="${options/ $i / }"; done; eval "$var=\"$options\""; fi; __gitcomp "$options" } __gitcomp_direct () { local IFS=' '; COMPREPLY=($1) } __gitcomp_direct_append () { local IFS=' '; COMPREPLY+=($1) } __gitcomp_file () { local IFS=' '; __gitcompadd "$1" "${2-}" "${3-$cur}" ""; compopt -o filenames +o nospace 2> /dev/null || compgen -f /non-existing-dir/ > /dev/null || true } __gitcomp_file_direct () { local IFS=' '; COMPREPLY=($1); compopt -o filenames +o nospace 2> /dev/null || compgen -f /non-existing-dir/ > /dev/null || true } __gitcomp_nl () { COMPREPLY=(); __gitcomp_nl_append "$@" } __gitcomp_nl_append () { local IFS=' '; __gitcompappend "$1" "${2-}" "${3-$cur}" "${4- }" } __gitcompadd () { COMPREPLY=(); __gitcompappend "$@" } __gitcompappend () { local x i=${#COMPREPLY[@]}; for x in $1; do if [[ "$x" == "$3"* ]]; then COMPREPLY[i++]="$2$x$4"; fi; done } __gitdir () { if [ -z "${1-}" ]; then __git_find_repo_path || return 1; echo "$__git_repo_path"; else if [ -d "$1/.git" ]; then echo "$1/.git"; else echo "$1"; fi; fi } __gitk_main () { __git_has_doubledash && return; local __git_repo_path; __git_find_repo_path; local merge=""; if [ -f "$__git_repo_path/MERGE_HEAD" ]; then merge="--merge"; fi; case "$cur" in --*) __gitcomp " $__git_log_common_options $__git_log_gitk_options $merge "; return ;; esac; __git_complete_revlist } __ibus () { COMPREPLY=(); local cur_=$2 prev_=$3 cur words cword prev; _get_comp_words_by_ref -n =: cur words cword prev; local cmds=(engine list-engine watch restart exit); local i c cmd subcmd; for ((i=1; i < ${#words[@]}-1; i++)) do [[ -n $cmd ]] && subcmd=${words[i]} && break; for c in ${cmds[@]}; do [[ ${words[i]} == $c ]] && cmd=$c && break; done; done; case $cmd in engine) __ibus_engine; return 0 ;; list-engine) __ibus_list_engine; return 0 ;; watch) return 0 ;; *) COMPREPLY=($( compgen -W '${cmds[@]}' -- "$cur" )); return 0 ;; esac } __ibus_engine () { if [[ "$cmd" == "$prev" ]]; then local imes=$( ibus list-engine --name-only 2>/dev/null ); COMPREPLY=($( compgen -W "$imes" -- "$cur" | sed "s/^$cur/$cur_/" )); fi } __ibus_list_engine () { if [[ "$cur" == -* ]]; then local options=(--name-only); COMPREPLY=($( compgen -W '${options[@]}' -- "$cur" )); fi } __load_completion () { local -a dirs=(${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions); local ifs=$IFS IFS=: dir cmd="${1##*/}" compfile; [[ -n $cmd ]] || return 1; for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do dirs+=($dir/bash-completion/completions); done; IFS=$ifs; if [[ $BASH_SOURCE == */* ]]; then dirs+=("${BASH_SOURCE%/*}/completions"); else dirs+=(./completions); fi; local backslash=; if [[ $cmd == \\* ]]; then cmd="${cmd:1}"; $(complete -p "$cmd" 2>/dev/null || echo false) "\\$cmd" && return 0; backslash=\\; fi; for dir in "${dirs[@]}"; do [[ -d $dir ]] || continue; for compfile in "$cmd" "$cmd.bash" "_$cmd"; do compfile="$dir/$compfile"; if [[ -f $compfile ]] && . "$compfile" &> /dev/null; then [[ -n $backslash ]] && $(complete -p "$cmd") "\\$cmd"; return 0; fi; done; done; [[ -v _xspecs[$cmd] ]] && complete -F _filedir_xspec "$cmd" "$backslash$cmd" && return 0; return 1 } __ltrim_colon_completions () { if [[ $1 == *:* && $COMP_WORDBREAKS == *:* ]]; then local colon_word=${1%"${1##*:}"}; local i=${#COMPREPLY[*]}; while ((i-- > 0)); do COMPREPLY[i]=${COMPREPLY[i]#"$colon_word"}; done; fi } __parse_options () { local option option2 i IFS=' ,/|'; option=; local -a array=($1); for i in "${array[@]}"; do case "$i" in ---*) break ;; --?*) option=$i; break ;; -?*) [[ -n $option ]] || option=$i ;; *) break ;; esac; done; [[ -n $option ]] || return 0; IFS=' '; if [[ $option =~ (\[((no|dont)-?)\]). ]]; then option2=${option/"${BASH_REMATCH[1]}"/}; option2=${option2%%[<{().[]*}; printf '%s\n' "${option2/=*/=}"; option=${option/"${BASH_REMATCH[1]}"/"${BASH_REMATCH[2]}"}; fi; option=${option%%[<{().[]*}; printf '%s\n' "${option/=*/=}" } __reassemble_comp_words_by_ref () { local exclude i j line ref; if [[ -n $1 ]]; then exclude="[${1//[^$COMP_WORDBREAKS]/}]"; fi; printf -v "$3" %s "$COMP_CWORD"; if [[ -v exclude ]]; then line=$COMP_LINE; for ((i = 0, j = 0; i < ${#COMP_WORDS[@]}; i++, j++)) do while [[ $i -gt 0 && ${COMP_WORDS[i]} == +($exclude) ]]; do [[ $line != [[:blank:]]* ]] && ((j >= 2)) && ((j--)); ref="$2[$j]"; printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}"; ((i == COMP_CWORD)) && printf -v "$3" %s "$j"; line=${line#*"${COMP_WORDS[i]}"}; [[ $line == [[:blank:]]* ]] && ((j++)); ((i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2; done; ref="$2[$j]"; printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}"; line=${line#*"${COMP_WORDS[i]}"}; ((i == COMP_CWORD)) && printf -v "$3" %s "$j"; done; ((i == COMP_CWORD)) && printf -v "$3" %s "$j"; else for i in "${!COMP_WORDS[@]}"; do printf -v "$2[i]" %s "${COMP_WORDS[i]}"; done; fi } _allowed_groups () { if _complete_as_root; then local IFS=' '; COMPREPLY=($(compgen -g -- "$1")); else local IFS=' '; COMPREPLY=($(compgen -W "$(id -Gn 2>/dev/null || groups 2>/dev/null)" -- "$1")); fi } _allowed_users () { if _complete_as_root; then local IFS=' '; COMPREPLY=($(compgen -u -- "${1:-$cur}")); else local IFS=' '; COMPREPLY=($(compgen -W "$(id -un 2>/dev/null || whoami 2>/dev/null)" -- "${1:-$cur}")); fi } _available_interfaces () { local PATH=$PATH:/sbin; COMPREPLY=($({ if [[ ${1:-} == -w ]]; then iwconfig elif [[ ${1:-} == -a ]]; then ifconfig || ip link show up else ifconfig -a || ip link show fi } 2>/dev/null | awk '/^[^ \t]/ { if ($1 ~ /^[0-9]+:/) { print $2 } else { print $1 } }')); COMPREPLY=($(compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur")) } _bashcomp_try_faketty () { if type unbuffer &> /dev/null; then unbuffer -p "$@"; else if script --version 2>&1 | command grep -qF util-linux; then script -qaefc "$*" /dev/null; else "$@"; fi; fi } _cd () { local cur prev words cword; _init_completion || return; local IFS=' ' i j k; compopt -o filenames; if [[ -z ${CDPATH:-} || $cur == ?(.)?(.)/* ]]; then _filedir -d; return; fi; local -r mark_dirs=$(_rl_enabled mark-directories && echo y); local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y); for i in ${CDPATH//:/' '}; do k="${#COMPREPLY[@]}"; for j in $(compgen -d -- $i/$cur); do if [[ ( -n $mark_symdirs && -L $j || -n $mark_dirs && ! -L $j ) && ! -d ${j#$i/} ]]; then j+="/"; fi; COMPREPLY[k++]=${j#$i/}; done; done; _filedir -d; if ((${#COMPREPLY[@]} == 1)); then i=${COMPREPLY[0]}; if [[ $i == "$cur" && $i != "*/" ]]; then COMPREPLY[0]="${i}/"; fi; fi; return } _cd_devices () { COMPREPLY+=($(compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}")) } _command () { local offset i; offset=1; for ((i = 1; i <= COMP_CWORD; i++)) do if [[ ${COMP_WORDS[i]} != -* ]]; then offset=$i; break; fi; done; _command_offset $offset } _command_offset () { local word_offset=$1 i j; for ((i = 0; i < word_offset; i++)) do for ((j = 0; j <= ${#COMP_LINE}; j++)) do [[ $COMP_LINE == "${COMP_WORDS[i]}"* ]] && break; COMP_LINE=${COMP_LINE:1}; ((COMP_POINT--)); done; COMP_LINE=${COMP_LINE#"${COMP_WORDS[i]}"}; ((COMP_POINT -= ${#COMP_WORDS[i]})); done; for ((i = 0; i <= COMP_CWORD - word_offset; i++)) do COMP_WORDS[i]=${COMP_WORDS[i + word_offset]}; done; for ((i; i <= COMP_CWORD; i++)) do unset 'COMP_WORDS[i]'; done; ((COMP_CWORD -= word_offset)); COMPREPLY=(); local cur; _get_comp_words_by_ref cur; if ((COMP_CWORD == 0)); then local IFS=' '; compopt -o filenames; COMPREPLY=($(compgen -d -c -- "$cur")); else local cmd=${COMP_WORDS[0]} compcmd=${COMP_WORDS[0]}; local cspec=$(complete -p $cmd 2>/dev/null); if [[ ! -n $cspec && $cmd == */* ]]; then cspec=$(complete -p ${cmd##*/} 2>/dev/null); [[ -n $cspec ]] && compcmd=${cmd##*/}; fi; if [[ ! -n $cspec ]]; then compcmd=${cmd##*/}; _completion_loader $compcmd; cspec=$(complete -p $compcmd 2>/dev/null); fi; if [[ -n $cspec ]]; then if [[ ${cspec#* -F } != "$cspec" ]]; then local func=${cspec#*-F }; func=${func%% *}; if ((${#COMP_WORDS[@]} >= 2)); then $func $cmd "${COMP_WORDS[-1]}" "${COMP_WORDS[-2]}"; else $func $cmd "${COMP_WORDS[-1]}"; fi; local opt; while [[ $cspec == *" -o "* ]]; do cspec=${cspec#*-o }; opt=${cspec%% *}; compopt -o $opt; cspec=${cspec#$opt}; done; else cspec=${cspec#complete}; cspec=${cspec%%$compcmd}; COMPREPLY=($(eval compgen "$cspec" -- '$cur')); fi; else if ((${#COMPREPLY[@]} == 0)); then _minimal; fi; fi; fi } _complete_as_root () { [[ $EUID -eq 0 || -n ${root_command:-} ]] } _completion_loader () { local cmd="${1:-_EmptycmD_}"; __load_completion "$cmd" && return 124; complete -F _minimal -- "$cmd" && return 124 } _configured_interfaces () { if [[ -f /etc/debian_version ]]; then COMPREPLY=($(compgen -W "$(command sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p' /etc/network/interfaces /etc/network/interfaces.d/* 2>/dev/null)" -- "$cur")); else if [[ -f /etc/SuSE-release ]]; then COMPREPLY=($(compgen -W "$(printf '%s\n' /etc/sysconfig/network/ifcfg-* | command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur")); else if [[ -f /etc/pld-release ]]; then COMPREPLY=($(compgen -W "$(command ls -B /etc/sysconfig/interfaces | command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur")); else COMPREPLY=($(compgen -W "$(printf '%s\n' /etc/sysconfig/network-scripts/ifcfg-* | command sed -ne 's|.*ifcfg-\([^*].*\)$|\1|p')" -- "$cur")); fi; fi; fi } _count_args () { local i cword words; __reassemble_comp_words_by_ref "${1-}" words cword; args=1; for ((i = 1; i < cword; i++)) do if [[ ${words[i]} != -* && ${words[i - 1]} != ${2-} || ${words[i]} == ${3-} ]]; then ((args++)); fi; done } _django_completion () { COMPREPLY=($( COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD DJANGO_AUTO_COMPLETE=1 $1 )) } _dkms () { local cur prev command module i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY=($( compgen -W "add remove build install uninstall match mkdriverdisk mktarball ldtarball mkrpm mkdeb mkkmp status" -- $cur )); else prev=${COMP_WORDS[COMP_CWORD-1]}; command=${COMP_WORDS[1]}; case $prev in -m) if [ "$command" = 'add' ]; then _filename_parts '.*-.*' 1; else _subdirectories /var/lib/dkms; fi; return 0 ;; -v) for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -m ]]; then module=${COMP_WORDS[i+1]}; break; fi; done; if [ -n "$module" ]; then if [ "$command" = 'add' ]; then _filename_parts "$module-.*" 2; else _subdirectories /var/lib/dkms/$module; fi; return 0; fi ;; -k) _kernels; return 0 ;; -@\(c | -spec | -archive | -config\)) _filedir; return 0 ;; --kernelsourcedir) _filedir -d; return 0 ;; esac; if [[ "$cur" == -* ]]; then case $command in add) options='-c --rpm_safe_upgrade' ;; remove) options='--rpm_safe_upgrade' ;; build) options='--config' ;; mkdriverdisk) options='-d --distro -r --release --size' ;; ldtarball) options='--archive --force' ;; mktarball) options='--source-only --binaries-only' ;; mkrpm) options='--source-only' ;; mkkmp) options='--spec' ;; match) options='--templatekernel' ;; esac; options="$options -m -v -k -a --arch -q --quiet -V --version --all --no-prepare-kernel --no-clean-kernel --kernelsourcedir --directive"; COMPREPLY=($( compgen -W "$options" -- $cur )); fi; fi } _dvd_devices () { COMPREPLY+=($(compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}")) } _expand () { case ${cur-} in ~*/*) __expand_tilde_by_ref cur ;; ~*) _tilde "$cur" || eval COMPREPLY[0]="$(printf ~%q "${COMPREPLY[0]#\~}")"; return ${#COMPREPLY[@]} ;; esac } _filedir () { local IFS=' '; _tilde "${cur-}" || return; local -a toks; local reset arg=${1-}; if [[ $arg == -d ]]; then reset=$(shopt -po noglob); set -o noglob; toks=($(compgen -d -- "${cur-}")); IFS=' '; $reset; IFS=' '; else local quoted; _quote_readline_by_ref "${cur-}" quoted; local xspec=${arg:+"!*.@($arg|${arg^^})"} plusdirs=(); local opts=(-f -X "$xspec"); [[ -n $xspec ]] && plusdirs=(-o plusdirs); [[ -n ${COMP_FILEDIR_FALLBACK-} || -z ${plusdirs-} ]] || opts+=("${plusdirs[@]}"); reset=$(shopt -po noglob); set -o noglob; toks+=($(compgen "${opts[@]}" -- $quoted)); IFS=' '; $reset; IFS=' '; [[ -n ${COMP_FILEDIR_FALLBACK-} && -n $arg && ${#toks[@]} -lt 1 ]] && { reset=$(shopt -po noglob); set -o noglob; toks+=($(compgen -f ${plusdirs+"${plusdirs[@]}"} -- $quoted)); IFS=' '; $reset; IFS=' ' }; fi; if ((${#toks[@]} != 0)); then compopt -o filenames 2> /dev/null; COMPREPLY+=("${toks[@]}"); fi } _filedir_xspec () { local cur prev words cword; _init_completion || return; _tilde "$cur" || return; local IFS=' ' xspec=${_xspecs[${1##*/}]} tmp; local -a toks; toks=($( compgen -d -- "$(quote_readline "$cur")" | { while read -r tmp; do printf '%s\n' $tmp done } )); eval xspec="${xspec}"; local matchop=!; if [[ $xspec == !* ]]; then xspec=${xspec#!}; matchop=@; fi; xspec="$matchop($xspec|${xspec^^})"; toks+=($( eval compgen -f -X "'!$xspec'" -- '$(quote_readline "$cur")' | { while read -r tmp; do [[ -n $tmp ]] && printf '%s\n' $tmp done } )); [[ -n ${COMP_FILEDIR_FALLBACK:-} && ${#toks[@]} -lt 1 ]] && { local reset=$(shopt -po noglob); set -o noglob; toks+=($(compgen -f -- "$(quote_readline "$cur")")); IFS=' '; $reset; IFS=' ' }; if ((${#toks[@]} != 0)); then compopt -o filenames; COMPREPLY=("${toks[@]}"); fi } _filename_parts () { COMPREPLY=($( command ls -F /usr/src 2>/dev/null | grep -E '^'$1'/$' | sed -r -e 's/^([^-]+)-(.+)\/$/\'$2'/' | grep "^$cur" )) } _fstypes () { local fss; if [[ -e /proc/filesystems ]]; then fss="$(cut -d' ' -f2 /proc/filesystems) $(awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null)"; else fss="$(awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null) $(awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null) $(awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null) $(awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null) $([[ -d /etc/fs ]] && command ls /etc/fs)"; fi; [[ -n $fss ]] && COMPREPLY+=($(compgen -W "$fss" -- "$cur")) } _get_comp_words_by_ref () { local exclude flag i OPTIND=1; local cur cword words=(); local upargs=() upvars=() vcur vcword vprev vwords; while getopts "c:i:n:p:w:" flag "$@"; do case $flag in c) vcur=$OPTARG ;; i) vcword=$OPTARG ;; n) exclude=$OPTARG ;; p) vprev=$OPTARG ;; w) vwords=$OPTARG ;; *) echo "bash_completion: $FUNCNAME: usage error" 1>&2; return 1 ;; esac; done; while [[ $# -ge $OPTIND ]]; do case ${!OPTIND} in cur) vcur=cur ;; prev) vprev=prev ;; cword) vcword=cword ;; words) vwords=words ;; *) echo "bash_completion: $FUNCNAME: \`${!OPTIND}':" "unknown argument" 1>&2; return 1 ;; esac; ((OPTIND += 1)); done; __get_cword_at_cursor_by_ref "${exclude-}" words cword cur; [[ -v vcur ]] && { upvars+=("$vcur"); upargs+=(-v $vcur "$cur") }; [[ -v vcword ]] && { upvars+=("$vcword"); upargs+=(-v $vcword "$cword") }; [[ -v vprev && $cword -ge 1 ]] && { upvars+=("$vprev"); upargs+=(-v $vprev "${words[cword - 1]}") }; [[ -v vwords ]] && { upvars+=("$vwords"); upargs+=(-a${#words[@]} $vwords ${words+"${words[@]}"}) }; ((${#upvars[@]})) && local "${upvars[@]}" && _upvars "${upargs[@]}" } _get_cword () { local LC_CTYPE=C; local cword words; __reassemble_comp_words_by_ref "${1-}" words cword; if [[ -n ${2-} && -n ${2//[^0-9]/} ]]; then printf "%s" "${words[cword - $2]}"; else if ((${#words[cword]} == 0 && COMP_POINT == ${#COMP_LINE})); then :; else local i; local cur="$COMP_LINE"; local index="$COMP_POINT"; for ((i = 0; i <= cword; ++i)) do while [[ ${#cur} -ge ${#words[i]} && ${cur:0:${#words[i]}} != "${words[i]}" ]]; do cur="${cur:1}"; ((index > 0)) && ((index--)); done; if ((i < cword)); then local old_size="${#cur}"; cur="${cur#${words[i]}}"; local new_size="${#cur}"; ((index -= old_size - new_size)); fi; done; if [[ ${words[cword]:0:${#cur}} != "$cur" ]]; then printf "%s" "${words[cword]}"; else printf "%s" "${cur:0:index}"; fi; fi; fi } _get_first_arg () { local i; arg=; for ((i = 1; i < COMP_CWORD; i++)) do if [[ ${COMP_WORDS[i]} != -* ]]; then arg=${COMP_WORDS[i]}; break; fi; done } _get_pword () { if ((COMP_CWORD >= 1)); then _get_cword "${@:-}" 1; fi } _gids () { if type getent &> /dev/null; then COMPREPLY=($(compgen -W '$(getent group | cut -d: -f3)' -- "$cur")); else if type perl &> /dev/null; then COMPREPLY=($(compgen -W '$(perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"')' -- "$cur")); else COMPREPLY=($(compgen -W '$(cut -d: -f3 /etc/group)' -- "$cur")); fi; fi } _git_add () { case "$cur" in --chmod=*) __gitcomp "+x -x" "" "${cur##--chmod=}"; return ;; --*) __gitcomp_builtin add; return ;; esac; local complete_opt="--others --modified --directory --no-empty-directory"; if test -n "$(__git_find_on_cmdline "-u --update")"; then complete_opt="--modified"; fi; __git_complete_index_file "$complete_opt" } _git_am () { __git_find_repo_path; if [ -d "$__git_repo_path"/rebase-apply ]; then __gitcomp "$__git_am_inprogress_options"; return; fi; case "$cur" in --whitespace=*) __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"; return ;; --patch-format=*) __gitcomp "$__git_patchformat" "" "${cur##--patch-format=}"; return ;; --show-current-patch=*) __gitcomp "$__git_showcurrentpatch" "" "${cur##--show-current-patch=}"; return ;; --*) __gitcomp_builtin am "" "$__git_am_inprogress_options"; return ;; esac } _git_apply () { case "$cur" in --whitespace=*) __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"; return ;; --*) __gitcomp_builtin apply; return ;; esac } _git_archive () { case "$cur" in --format=*) __gitcomp "$(git archive --list)" "" "${cur##--format=}"; return ;; --remote=*) __gitcomp_nl "$(__git_remotes)" "" "${cur##--remote=}"; return ;; --*) __gitcomp_builtin archive "--format= --list --verbose --prefix= --worktree-attributes"; return ;; esac; __git_complete_file } _git_bisect () { __git_has_doubledash && return; local subcommands="start bad good skip reset visualize replay log run"; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then __git_find_repo_path; if [ -f "$__git_repo_path"/BISECT_START ]; then __gitcomp "$subcommands"; else __gitcomp "replay start"; fi; return; fi; case "$subcommand" in bad | good | reset | skip | start) __git_complete_refs ;; *) ;; esac } _git_branch () { local i c=1 only_local_ref="n" has_r="n"; while [ $c -lt $cword ]; do i="${words[c]}"; case "$i" in -d | --delete | -m | --move) only_local_ref="y" ;; -r | --remotes) has_r="y" ;; esac; ((c++)); done; case "$cur" in --set-upstream-to=*) __git_complete_refs --cur="${cur##--set-upstream-to=}" ;; --*) __gitcomp_builtin branch ;; *) if [ $only_local_ref = "y" -a $has_r = "n" ]; then __gitcomp_direct "$(__git_heads "" "$cur" " ")"; else __git_complete_refs; fi ;; esac } _git_bundle () { local cmd="${words[2]}"; case "$cword" in 2) __gitcomp "create list-heads verify unbundle" ;; 3) ;; *) case "$cmd" in create) __git_complete_revlist ;; esac ;; esac } _git_checkout () { __git_has_doubledash && return; local dwim_opt="$(__git_checkout_default_dwim_mode)"; case "$prev" in -b | -B | --orphan) __git_complete_refs $dwim_opt --mode="heads"; return ;; *) ;; esac; case "$cur" in --conflict=*) __gitcomp "diff3 merge" "" "${cur##--conflict=}" ;; --*) __gitcomp_builtin checkout ;; *) if [ -n "$(__git_find_on_cmdline "-b -B -d --detach --orphan")" ]; then __git_complete_refs --mode="refs"; else if [ -n "$(__git_find_on_cmdline "--track")" ]; then __git_complete_refs --mode="remote-heads"; else __git_complete_refs $dwim_opt --mode="refs"; fi; fi ;; esac } _git_cherry_pick () { __git_find_repo_path; if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then __gitcomp "$__git_cherry_pick_inprogress_options"; return; fi; __git_complete_strategy && return; case "$cur" in --*) __gitcomp_builtin cherry-pick "" "$__git_cherry_pick_inprogress_options" ;; *) __git_complete_refs ;; esac } _git_clean () { case "$cur" in --*) __gitcomp_builtin clean; return ;; esac; __git_complete_index_file "--others --directory" } _git_clone () { case "$prev" in -c | --config) __git_complete_config_variable_name_and_value; return ;; esac; case "$cur" in --config=*) __git_complete_config_variable_name_and_value --cur="${cur##--config=}"; return ;; --*) __gitcomp_builtin clone; return ;; esac } _git_commit () { case "$prev" in -c | -C) __git_complete_refs; return ;; esac; case "$cur" in --cleanup=*) __gitcomp "default scissors strip verbatim whitespace " "" "${cur##--cleanup=}"; return ;; --reuse-message=* | --reedit-message=* | --fixup=* | --squash=*) __git_complete_refs --cur="${cur#*=}"; return ;; --untracked-files=*) __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"; return ;; --*) __gitcomp_builtin commit; return ;; esac; if __git rev-parse --verify --quiet HEAD > /dev/null; then __git_complete_index_file "--committable"; else __git_complete_index_file "--cached"; fi } _git_config () { case "$prev" in --get | --get-all | --unset | --unset-all) __gitcomp_nl "$(__git_config_get_set_variables)"; return ;; *.*) __git_complete_config_variable_value; return ;; esac; case "$cur" in --*) __gitcomp_builtin config ;; *) __git_complete_config_variable_name ;; esac } _git_describe () { case "$cur" in --*) __gitcomp_builtin describe; return ;; esac; __git_complete_refs } _git_diff () { __git_has_doubledash && return; case "$cur" in --diff-algorithm=*) __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"; return ;; --submodule=*) __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"; return ;; --color-moved=*) __gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}"; return ;; --color-moved-ws=*) __gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"; return ;; --*) __gitcomp "$__git_diff_difftool_options"; return ;; esac; __git_complete_revlist_file } _git_difftool () { __git_has_doubledash && return; case "$cur" in --tool=*) __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}"; return ;; --*) __gitcomp_builtin difftool "$__git_diff_difftool_options"; return ;; esac; __git_complete_revlist_file } _git_fetch () { case "$cur" in --recurse-submodules=*) __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"; return ;; --filter=*) __gitcomp "blob:none blob:limit= sparse:oid=" "" "${cur##--filter=}"; return ;; --*) __gitcomp_builtin fetch; return ;; esac; __git_complete_remote_or_refspec } _git_format_patch () { case "$cur" in --thread=*) __gitcomp " deep shallow " "" "${cur##--thread=}"; return ;; --base=* | --interdiff=* | --range-diff=*) __git_complete_refs --cur="${cur#--*=}"; return ;; --*) __gitcomp_builtin format-patch "$__git_format_patch_extra_options"; return ;; esac; __git_complete_revlist } _git_fsck () { case "$cur" in --*) __gitcomp_builtin fsck; return ;; esac } _git_gitk () { __gitk_main } _git_grep () { __git_has_doubledash && return; case "$cur" in --*) __gitcomp_builtin grep; return ;; esac; case "$cword,$prev" in 2,* | *,-*) __git_complete_symbol && return ;; esac; __git_complete_refs } _git_help () { case "$cur" in --*) __gitcomp_builtin help; return ;; esac; if test -n "$GIT_TESTING_ALL_COMMAND_LIST"; then __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk"; else __gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk"; fi } _git_init () { case "$cur" in --shared=*) __gitcomp " false true umask group all world everybody " "" "${cur##--shared=}"; return ;; --*) __gitcomp_builtin init; return ;; esac } _git_log () { __git_has_doubledash && return; __git_find_repo_path; local merge=""; if [ -f "$__git_repo_path/MERGE_HEAD" ]; then merge="--merge"; fi; case "$prev,$cur" in -L,:*:*) return ;; -L,:*) __git_complete_symbol --cur="${cur#:}" --sfx=":"; return ;; -G,* | -S,*) __git_complete_symbol; return ;; esac; case "$cur" in --pretty=* | --format=*) __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) " "" "${cur#*=}"; return ;; --date=*) __gitcomp "$__git_log_date_formats" "" "${cur##--date=}"; return ;; --decorate=*) __gitcomp "full short no" "" "${cur##--decorate=}"; return ;; --diff-algorithm=*) __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"; return ;; --submodule=*) __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"; return ;; --no-walk=*) __gitcomp "sorted unsorted" "" "${cur##--no-walk=}"; return ;; --*) __gitcomp " $__git_log_common_options $__git_log_shortlog_options $__git_log_gitk_options --root --topo-order --date-order --reverse --follow --full-diff --abbrev-commit --no-abbrev-commit --abbrev= --relative-date --date= --pretty= --format= --oneline --show-signature --cherry-mark --cherry-pick --graph --decorate --decorate= --no-decorate --walk-reflogs --no-walk --no-walk= --do-walk --parents --children --expand-tabs --expand-tabs= --no-expand-tabs $merge $__git_diff_common_options --pickaxe-all --pickaxe-regex "; return ;; -L:*:*) return ;; -L:*) __git_complete_symbol --cur="${cur#-L:}" --sfx=":"; return ;; -G*) __git_complete_symbol --pfx="-G" --cur="${cur#-G}"; return ;; -S*) __git_complete_symbol --pfx="-S" --cur="${cur#-S}"; return ;; esac; __git_complete_revlist } _git_ls_files () { case "$cur" in --*) __gitcomp_builtin ls-files; return ;; esac; __git_complete_index_file "--cached" } _git_ls_remote () { case "$cur" in --*) __gitcomp_builtin ls-remote; return ;; esac; __gitcomp_nl "$(__git_remotes)" } _git_ls_tree () { case "$cur" in --*) __gitcomp_builtin ls-tree; return ;; esac; __git_complete_file } _git_merge () { __git_complete_strategy && return; case "$cur" in --*) __gitcomp_builtin merge; return ;; esac; __git_complete_refs } _git_merge_base () { case "$cur" in --*) __gitcomp_builtin merge-base; return ;; esac; __git_complete_refs } _git_mergetool () { case "$cur" in --tool=*) __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"; return ;; --*) __gitcomp "--tool= --prompt --no-prompt --gui --no-gui"; return ;; esac } _git_mv () { case "$cur" in --*) __gitcomp_builtin mv; return ;; esac; if [ $(__git_count_arguments "mv") -gt 0 ]; then __git_complete_index_file "--cached --others --directory"; else __git_complete_index_file "--cached"; fi } _git_notes () { local subcommands='add append copy edit get-ref list merge prune remove show'; local subcommand="$(__git_find_on_cmdline "$subcommands")"; case "$subcommand,$cur" in ,--*) __gitcomp_builtin notes ;; ,*) case "$prev" in --ref) __git_complete_refs ;; *) __gitcomp "$subcommands --ref" ;; esac ;; *,--reuse-message=* | *,--reedit-message=*) __git_complete_refs --cur="${cur#*=}" ;; *,--*) __gitcomp_builtin notes_$subcommand ;; prune,* | get-ref,*) ;; *) case "$prev" in -m | -F) ;; *) __git_complete_refs ;; esac ;; esac } _git_pull () { __git_complete_strategy && return; case "$cur" in --recurse-submodules=*) __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"; return ;; --*) __gitcomp_builtin pull; return ;; esac; __git_complete_remote_or_refspec } _git_push () { case "$prev" in --repo) __gitcomp_nl "$(__git_remotes)"; return ;; --recurse-submodules) __gitcomp "$__git_push_recurse_submodules"; return ;; esac; case "$cur" in --repo=*) __gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}"; return ;; --recurse-submodules=*) __gitcomp "$__git_push_recurse_submodules" "" "${cur##--recurse-submodules=}"; return ;; --force-with-lease=*) __git_complete_force_with_lease "${cur##--force-with-lease=}"; return ;; --*) __gitcomp_builtin push; return ;; esac; __git_complete_remote_or_refspec } _git_range_diff () { case "$cur" in --*) __gitcomp " --creation-factor= --no-dual-color $__git_diff_common_options "; return ;; esac; __git_complete_revlist } _git_rebase () { __git_find_repo_path; if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then __gitcomp "$__git_rebase_interactive_inprogress_options"; return; else if [ -d "$__git_repo_path"/rebase-apply ] || [ -d "$__git_repo_path"/rebase-merge ]; then __gitcomp "$__git_rebase_inprogress_options"; return; fi; fi; __git_complete_strategy && return; case "$cur" in --whitespace=*) __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"; return ;; --onto=*) __git_complete_refs --cur="${cur##--onto=}"; return ;; --*) __gitcomp_builtin rebase "" "$__git_rebase_interactive_inprogress_options"; return ;; esac; __git_complete_refs } _git_reflog () { local subcommands="show delete expire"; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then __gitcomp "$subcommands"; else __git_complete_refs; fi } _git_remote () { local subcommands=" add rename remove set-head set-branches get-url set-url show prune update "; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then case "$cur" in --*) __gitcomp_builtin remote ;; *) __gitcomp "$subcommands" ;; esac; return; fi; case "$subcommand,$cur" in add,--*) __gitcomp_builtin remote_add ;; add,*) ;; set-head,--*) __gitcomp_builtin remote_set-head ;; set-branches,--*) __gitcomp_builtin remote_set-branches ;; set-head,* | set-branches,*) __git_complete_remote_or_refspec ;; update,--*) __gitcomp_builtin remote_update ;; update,*) __gitcomp "$(__git_remotes) $(__git_get_config_variables "remotes")" ;; set-url,--*) __gitcomp_builtin remote_set-url ;; get-url,--*) __gitcomp_builtin remote_get-url ;; prune,--*) __gitcomp_builtin remote_prune ;; *) __gitcomp_nl "$(__git_remotes)" ;; esac } _git_replace () { case "$cur" in --format=*) __gitcomp "short medium long" "" "${cur##--format=}"; return ;; --*) __gitcomp_builtin replace; return ;; esac; __git_complete_refs } _git_rerere () { local subcommands="clear forget diff remaining status gc"; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if test -z "$subcommand"; then __gitcomp "$subcommands"; return; fi } _git_reset () { __git_has_doubledash && return; case "$cur" in --*) __gitcomp_builtin reset; return ;; esac; __git_complete_refs } _git_restore () { case "$prev" in -s) __git_complete_refs; return ;; esac; case "$cur" in --conflict=*) __gitcomp "diff3 merge" "" "${cur##--conflict=}" ;; --source=*) __git_complete_refs --cur="${cur##--source=}" ;; --*) __gitcomp_builtin restore ;; esac } _git_revert () { __git_find_repo_path; if [ -f "$__git_repo_path"/REVERT_HEAD ]; then __gitcomp "$__git_revert_inprogress_options"; return; fi; __git_complete_strategy && return; case "$cur" in --*) __gitcomp_builtin revert "" "$__git_revert_inprogress_options"; return ;; esac; __git_complete_refs } _git_rm () { case "$cur" in --*) __gitcomp_builtin rm; return ;; esac; __git_complete_index_file "--cached" } _git_send_email () { case "$prev" in --to | --cc | --bcc | --from) __gitcomp "$(__git send-email --dump-aliases)"; return ;; esac; case "$cur" in --confirm=*) __gitcomp " $__git_send_email_confirm_options " "" "${cur##--confirm=}"; return ;; --suppress-cc=*) __gitcomp " $__git_send_email_suppresscc_options " "" "${cur##--suppress-cc=}"; return ;; --smtp-encryption=*) __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}"; return ;; --thread=*) __gitcomp " deep shallow " "" "${cur##--thread=}"; return ;; --to=* | --cc=* | --bcc=* | --from=*) __gitcomp "$(__git send-email --dump-aliases)" "" "${cur#--*=}"; return ;; --*) __gitcomp_builtin send-email "--annotate --bcc --cc --cc-cmd --chain-reply-to --compose --confirm= --dry-run --envelope-sender --from --identity --in-reply-to --no-chain-reply-to --no-signed-off-by-cc --no-suppress-from --no-thread --quiet --reply-to --signed-off-by-cc --smtp-pass --smtp-server --smtp-server-port --smtp-encryption= --smtp-user --subject --suppress-cc= --suppress-from --thread --to --validate --no-validate $__git_format_patch_extra_options"; return ;; esac; __git_complete_revlist } _git_shortlog () { __git_has_doubledash && return; case "$cur" in --*) __gitcomp " $__git_log_common_options $__git_log_shortlog_options --numbered --summary --email "; return ;; esac; __git_complete_revlist } _git_show () { __git_has_doubledash && return; case "$cur" in --pretty=* | --format=*) __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) " "" "${cur#*=}"; return ;; --diff-algorithm=*) __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"; return ;; --submodule=*) __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"; return ;; --color-moved=*) __gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}"; return ;; --color-moved-ws=*) __gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"; return ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit --oneline --show-signature --expand-tabs --expand-tabs= --no-expand-tabs $__git_diff_common_options "; return ;; esac; __git_complete_revlist_file } _git_show_branch () { case "$cur" in --*) __gitcomp_builtin show-branch; return ;; esac; __git_complete_revlist } _git_sparse_checkout () { local subcommands="list init set disable"; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then __gitcomp "$subcommands"; return; fi; case "$subcommand,$cur" in init,--*) __gitcomp "--cone" ;; set,--*) __gitcomp "--stdin" ;; *) ;; esac } _git_stage () { _git_add } _git_stash () { local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'; local subcommands='push list show apply clear drop pop create branch'; local subcommand="$(__git_find_on_cmdline "$subcommands save")"; if [ -z "$subcommand" -a -n "$(__git_find_on_cmdline "-p")" ]; then subcommand="push"; fi; if [ -z "$subcommand" ]; then case "$cur" in --*) __gitcomp "$save_opts" ;; sa*) if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then __gitcomp "save"; fi ;; *) if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then __gitcomp "$subcommands"; fi ;; esac; else case "$subcommand,$cur" in push,--*) __gitcomp "$save_opts --message" ;; save,--*) __gitcomp "$save_opts" ;; apply,--* | pop,--*) __gitcomp "--index --quiet" ;; drop,--*) __gitcomp "--quiet" ;; list,--*) __gitcomp "--name-status --oneline --patch-with-stat" ;; show,--*) __gitcomp "$__git_diff_common_options" ;; branch,--*) ;; branch,*) if [ $cword -eq 3 ]; then __git_complete_refs; else __gitcomp_nl "$(__git stash list | sed -n -e 's/:.*//p')"; fi ;; show,* | apply,* | drop,* | pop,*) __gitcomp_nl "$(__git stash list | sed -n -e 's/:.*//p')" ;; *) ;; esac; fi } _git_status () { local complete_opt; local untracked_state; case "$cur" in --ignore-submodules=*) __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"; return ;; --untracked-files=*) __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"; return ;; --column=*) __gitcomp " always never auto column row plain dense nodense " "" "${cur##--column=}"; return ;; --*) __gitcomp_builtin status; return ;; esac; untracked_state="$(__git_get_option_value "-u" "--untracked-files=" "$__git_untracked_file_modes" "status.showUntrackedFiles")"; case "$untracked_state" in no) complete_opt= ;; all | normal | *) complete_opt="--cached --directory --no-empty-directory --others"; if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then complete_opt="$complete_opt --ignored --exclude=*"; fi ;; esac; __git_complete_index_file "$complete_opt" } _git_submodule () { __git_has_doubledash && return; local subcommands="add status init deinit update set-branch set-url summary foreach sync absorbgitdirs"; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then case "$cur" in --*) __gitcomp "--quiet" ;; *) __gitcomp "$subcommands" ;; esac; return; fi; case "$subcommand,$cur" in add,--*) __gitcomp "--branch --force --name --reference --depth" ;; status,--*) __gitcomp "--cached --recursive" ;; deinit,--*) __gitcomp "--force --all" ;; update,--*) __gitcomp " --init --remote --no-fetch --recommend-shallow --no-recommend-shallow --force --rebase --merge --reference --depth --recursive --jobs " ;; set-branch,--*) __gitcomp "--default --branch" ;; summary,--*) __gitcomp "--cached --files --summary-limit" ;; foreach,--* | sync,--*) __gitcomp "--recursive" ;; *) ;; esac } _git_svn () { local subcommands=" init fetch clone rebase dcommit log find-rev set-tree commit-diff info create-ignore propget proplist show-ignore show-externals branch tag blame migrate mkdirs reset gc "; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then __gitcomp "$subcommands"; else local remote_opts="--username= --config-dir= --no-auth-cache"; local fc_opts=" --follow-parent --authors-file= --repack= --no-metadata --use-svm-props --use-svnsync-props --log-window-size= --no-checkout --quiet --repack-flags --use-log-author --localtime --add-author-from --recursive --ignore-paths= --include-paths= $remote_opts "; local init_opts=" --template= --shared= --trunk= --tags= --branches= --stdlayout --minimize-url --no-metadata --use-svm-props --use-svnsync-props --rewrite-root= --prefix= $remote_opts "; local cmt_opts=" --edit --rmdir --find-copies-harder --copy-similarity= "; case "$subcommand,$cur" in fetch,--*) __gitcomp "--revision= --fetch-all $fc_opts" ;; clone,--*) __gitcomp "--revision= $fc_opts $init_opts" ;; init,--*) __gitcomp "$init_opts" ;; dcommit,--*) __gitcomp " --merge --strategy= --verbose --dry-run --fetch-all --no-rebase --commit-url --revision --interactive $cmt_opts $fc_opts " ;; set-tree,--*) __gitcomp "--stdin $cmt_opts $fc_opts" ;; create-ignore,--* | propget,--* | proplist,--* | show-ignore,--* | show-externals,--* | mkdirs,--*) __gitcomp "--revision=" ;; log,--*) __gitcomp " --limit= --revision= --verbose --incremental --oneline --show-commit --non-recursive --authors-file= --color " ;; rebase,--*) __gitcomp " --merge --verbose --strategy= --local --fetch-all --dry-run $fc_opts " ;; commit-diff,--*) __gitcomp "--message= --file= --revision= $cmt_opts" ;; info,--*) __gitcomp "--url" ;; branch,--*) __gitcomp "--dry-run --message --tag" ;; tag,--*) __gitcomp "--dry-run --message" ;; blame,--*) __gitcomp "--git-format" ;; migrate,--*) __gitcomp " --config-dir= --ignore-paths= --minimize --no-auth-cache --username= " ;; reset,--*) __gitcomp "--revision= --parent" ;; *) ;; esac; fi } _git_switch () { local dwim_opt="$(__git_checkout_default_dwim_mode)"; case "$prev" in -c | -C | --orphan) __git_complete_refs $dwim_opt --mode="heads"; return ;; *) ;; esac; case "$cur" in --conflict=*) __gitcomp "diff3 merge" "" "${cur##--conflict=}" ;; --*) __gitcomp_builtin switch ;; *) if [ -n "$(__git_find_on_cmdline "--orphan")" ]; then return; fi; if [ -n "$(__git_find_on_cmdline "-c -C -d --detach")" ]; then __git_complete_refs --mode="refs"; else if [ -n "$(__git_find_on_cmdline "--track")" ]; then __git_complete_refs --mode="remote-heads"; else __git_complete_refs $dwim_opt --mode="heads"; fi; fi ;; esac } _git_tag () { local i c=1 f=0; while [ $c -lt $cword ]; do i="${words[c]}"; case "$i" in -d | --delete | -v | --verify) __gitcomp_direct "$(__git_tags "" "$cur" " ")"; return ;; -f) f=1 ;; esac; ((c++)); done; case "$prev" in -m | -F) ;; -* | tag) if [ $f = 1 ]; then __gitcomp_direct "$(__git_tags "" "$cur" " ")"; fi ;; *) __git_complete_refs ;; esac; case "$cur" in --*) __gitcomp_builtin tag ;; esac } _git_whatchanged () { _git_log } _git_worktree () { local subcommands="add list lock move prune remove unlock"; local subcommand subcommand_idx; subcommand="$(__git_find_on_cmdline --show-idx "$subcommands")"; subcommand_idx="${subcommand% *}"; subcommand="${subcommand#* }"; case "$subcommand,$cur" in ,*) __gitcomp "$subcommands" ;; *,--*) __gitcomp_builtin worktree_$subcommand ;; add,*) case "$prev" in -b | -B) __git_complete_refs ;; -*) ;; *) if [ $cword -eq $((subcommand_idx+1)) ]; then :; else case "${words[cword-2]}" in -b | -B) ;; *) __git_complete_refs ;; esac; fi ;; esac ;; lock,* | remove,* | unlock,*) __git_complete_worktree_paths ;; move,*) if [ $cword -eq $((subcommand_idx+1)) ]; then __git_complete_worktree_paths; else :; fi ;; esac } _have () { PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &> /dev/null } _hg () { local cur prev cmd cmd_index opts i aliashg; local global_args='--cwd|-R|--repository|--color|--config|--encoding|--encodingmode|--pager'; local hg="$1"; local canonical=0; aliashg=$(alias $hg 2>/dev/null); if [[ -n "$aliashg" ]]; then aliashg=${aliashg#"alias $hg='"}; aliashg=${aliashg%"'"}; if [[ "${aliashg:0:7}" != "source " ]]; then hg=$aliashg; fi; fi; COMPREPLY=(); cur="$2"; prev="$3"; for ((i=1; $i<=$COMP_CWORD; i++)) do if [[ ${COMP_WORDS[i]} != -* ]]; then if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then cmd="${COMP_WORDS[i]}"; cmd_index=$i; break; fi; fi; done; if [[ "$cur" == -* ]]; then if [ "$(type -t "_hg_opt_$cmd")" = function ] && "_hg_opt_$cmd"; then _hg_fix_wordlist; return; fi; opts=$(HGPLAINEXCEPT=alias _hg_cmd debugcomplete --options "$cmd"); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur")); _hg_fix_wordlist; return; fi; case "$prev" in -R | --repository) _hg_paths; _hg_repos; _hg_fix_wordlist; return ;; --cwd) _hg_fix_wordlist; return ;; --color) local choices='true false yes no always auto never debug'; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$choices' -- "$cur")); _hg_fix_wordlist; return ;; --pager) local choices='true false yes no always auto never'; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$choices' -- "$cur")); _hg_fix_wordlist; return ;; esac; if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then _hg_commands; _hg_fix_wordlist; return; fi; local help; if _hg_command_specific; then _hg_fix_wordlist; return; fi; help=$(_hg_cmd help "$cmd"); if [ $? -ne 0 ]; then return; fi; cmd=${help#hg }; cmd=${cmd%%[' ']*}; canonical=1; _hg_command_specific; _hg_fix_wordlist } _hg_bookmarks () { local bookmarks="$(_hg_cmd bookmarks -q)"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur")) } _hg_branches () { local branches="$(_hg_cmd branches -q)"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur")) } _hg_cmd () { HGPLAIN=1 "$hg" "$@" 2> /dev/null } _hg_cmd_bisect () { local i subcmd; for ((i=cmd_index+1; i<=COMP_CWORD; i++)) do if [[ ${COMP_WORDS[i]} != -* ]]; then if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then subcmd="${COMP_WORDS[i]}"; break; fi; fi; done; if [ -z "$subcmd" ] || [ $COMP_CWORD -eq $i ] || [ "$subcmd" = help ]; then COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W 'bad good help init next reset' -- "$cur")); return; fi; case "$subcmd" in good | bad) _hg_labels ;; esac; return } _hg_cmd_bookmarks () { _hg_bookmarks; return } _hg_cmd_email () { case "$prev" in -c | --cc | -t | --to | -f | --from | --bcc) if [ "$(type -t _hg_emails)" = function ]; then local arg=to; if [[ "$prev" == @(-f|--from) ]]; then arg=from; fi; local addresses=$(_hg_emails $arg); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$addresses' -- "$cur")); fi; return ;; -m | --mbox) return ;; -s | --subject) return ;; esac; _hg_labels; return } _hg_cmd_qclone () { local count=$(_hg_count_non_option); if [ $count = 1 ]; then _hg_paths; fi; _hg_repos } _hg_cmd_qcommit () { local root=$(_hg_cmd root); local files=$(cd "$root/.hg/patches" && _hg_cmd status -nmar); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) } _hg_cmd_qdelete () { local qcmd=qunapplied; if [[ "$prev" = @(-r|--rev) ]]; then qcmd=qapplied; fi; _hg_ext_mq_patchlist $qcmd } _hg_cmd_qfinish () { if [[ "$prev" = @(-a|--applied) ]]; then return; fi; _hg_ext_mq_patchlist qapplied } _hg_cmd_qfold () { _hg_ext_mq_patchlist qunapplied } _hg_cmd_qgoto () { if [[ "$prev" = @(-n|--name) ]]; then _hg_ext_mq_queues; return; fi; _hg_ext_mq_patchlist qseries } _hg_cmd_qguard () { local prefix=''; if [[ "$cur" == +* ]]; then prefix=+; else if [[ "$cur" == -* ]]; then prefix=-; fi; fi; local ncur=${cur#[-+]}; if ! [ "$prefix" ]; then _hg_ext_mq_patchlist qseries; return; fi; local guards=$(_hg_ext_mq_guards); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -P $prefix -W '$guards' -- "$ncur")) } _hg_cmd_qheader () { _hg_ext_mq_patchlist qseries } _hg_cmd_qpop () { if [[ "$prev" = @(-n|--name) ]]; then _hg_ext_mq_queues; return; fi; _hg_ext_mq_patchlist qapplied } _hg_cmd_qpush () { if [[ "$prev" = @(-n|--name) ]]; then _hg_ext_mq_queues; return; fi; _hg_ext_mq_patchlist qunapplied } _hg_cmd_qqueue () { local q; local queues; local opts="--list --create --rename --delete --purge"; queues=$( _hg_cmd qqueue --quiet ); COMPREPLY=($( compgen -W "${opts} ${queues}" "${cur}" )) } _hg_cmd_qrename () { _hg_ext_mq_patchlist qseries } _hg_cmd_qsave () { if [[ "$prev" = @(-n|--name) ]]; then _hg_ext_mq_queues; return; fi } _hg_cmd_qselect () { local guards=$(_hg_ext_mq_guards); COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$guards' -- "$cur")) } _hg_cmd_rebase () { if [[ "$prev" = @(-s|--source|-d|--dest|-b|--base|-r|--rev) ]]; then _hg_labels; return; fi } _hg_cmd_shelve () { if [[ "$prev" = @(-d|--delete|-l|--list|-p|--patch|--stat) ]]; then _hg_shelves; else _hg_status "mard"; fi } _hg_cmd_sign () { _hg_labels } _hg_cmd_strip () { if [[ "$prev" = @(-B|--bookmark) ]]; then _hg_bookmarks; return; fi; _hg_labels } _hg_cmd_transplant () { case "$prev" in -s | --source) _hg_paths; _hg_repos; return ;; --filter) return ;; esac; _hg_labels; return } _hg_cmd_unshelve () { _hg_shelves } _hg_command_specific () { if [ "$(type -t "_hg_cmd_$cmd")" = function ]; then "_hg_cmd_$cmd"; return 0; fi; if [ "$cmd" != status ]; then case "$prev" in -r | --rev) if [[ $canonical = 1 || status != "$cmd"* ]]; then _hg_labels; return 0; fi; return 1 ;; -B | --bookmark) if [[ $canonical = 1 || status != "$cmd"* ]]; then _hg_bookmarks; return 0; fi; return 1 ;; -b | --branch) if [[ $canonical = 1 || status != "$cmd"* ]]; then _hg_branches; return 0; fi; return 1 ;; esac; fi; local aliascmd=$(_hg_cmd showconfig alias.$cmd | awk '{print $1}'); [ -n "$aliascmd" ] && cmd=$aliascmd; case "$cmd" in help) _hg_commands ;; export) if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then return 0; fi; _hg_labels ;; manifest | update | up | checkout | co) _hg_labels ;; pull | push | outgoing | incoming) _hg_paths; _hg_repos ;; paths) _hg_paths ;; add) _hg_status "u" ;; merge) _hg_labels ;; commit | ci | record | amend) _hg_status "mar" ;; remove | rm) _hg_debugpathcomplete -n ;; forget) _hg_debugpathcomplete -fa ;; diff) _hg_status "mar" ;; revert) _hg_status "mard" ;; clone) local count=$(_hg_count_non_option); if [ $count = 1 ]; then _hg_paths; fi; _hg_repos ;; debugindex | debugindexdot) COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.i" -- "$cur")) ;; debugdata) COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.d" -- "$cur")) ;; *) return 1 ;; esac; return 0 } _hg_commands () { local commands; commands="$(HGPLAINEXCEPT=alias _hg_cmd debugcomplete "$cur")" || commands=""; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur")) } _hg_count_non_option () { local i count=0; local filters="$1"; for ((i=1; $i<=$COMP_CWORD; i++)) do if [[ "${COMP_WORDS[i]}" != -* ]]; then if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then continue; fi; count=$(($count + 1)); fi; done; echo $(($count - 1)) } _hg_debugpathcomplete () { local files="$(_hg_cmd debugpathcomplete $1 "$cur")"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) } _hg_ext_mq_guards () { _hg_cmd qselect --series | sed -e 's/^.//' } _hg_ext_mq_patchlist () { local patches; patches=$(_hg_cmd $1); if [ $? -eq 0 ] && [ "$patches" ]; then COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur")); return 0; fi; return 1 } _hg_ext_mq_queues () { local root=$(_hg_cmd root); local n; for n in $(cd "$root"/.hg && compgen -d -- "$cur"); do if [ "$n" != patches ] && [ -e "$root/.hg/$n/series" ]; then COMPREPLY=(${COMPREPLY[@]:-} "$n"); fi; done } _hg_fix_wordlist () { local LASTCHAR=' '; if [ ${#COMPREPLY[@]} = 1 ]; then [ -d "$COMPREPLY" ] && LASTCHAR=/; COMPREPLY=$(printf %q%s "$COMPREPLY" "$LASTCHAR"); else for ((i=0; i < ${#COMPREPLY[@]}; i++)) do [ -d "${COMPREPLY[$i]}" ] && COMPREPLY[$i]=${COMPREPLY[$i]}/; done; fi } _hg_labels () { local labels="$(_hg_cmd debugnamecomplete "$cur")"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$labels' -- "$cur")) } _hg_opt_qguard () { local i; for ((i=cmd_index+1; i<=COMP_CWORD; i++)) do if [[ ${COMP_WORDS[i]} != -* ]]; then if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then _hg_cmd_qguard; return 0; fi; else if [ "${COMP_WORDS[i]}" = -- ]; then _hg_cmd_qguard; return 0; fi; fi; done; return 1 } _hg_paths () { local paths="$(_hg_cmd paths -q)"; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$paths' -- "$cur")) } _hg_repos () { local i; for i in $(compgen -d -- "$cur"); do test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i"); done } _hg_shelves () { local shelves="$(_hg_cmd shelve -ql)"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$shelves' -- "$cur")) } _hg_status () { if [ -z "$HGCOMPLETE_NOSTATUS" ]; then local files="$(_hg_cmd status -n$1 "glob:$cur**")"; local IFS=' '; COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")); fi } _included_ssh_config_files () { (($# < 1)) && echo "bash_completion: $FUNCNAME: missing mandatory argument CONFIG" 1>&2; local configfile i f; configfile=$1; local reset=$(shopt -po noglob); set -o noglob; local included=($(command sed -ne 's/^[[:blank:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:blank:]]\(.*\)$/\1/p' "${configfile}")); $reset; [[ -n ${included-} ]] || return; for i in "${included[@]}"; do if ! [[ $i =~ ^\~.*|^\/.* ]]; then if [[ $configfile =~ ^\/etc\/ssh.* ]]; then i="/etc/ssh/$i"; else i="$HOME/.ssh/$i"; fi; fi; __expand_tilde_by_ref i; set +o noglob; for f in $i; do if [[ -r $f ]]; then config+=("$f"); _included_ssh_config_files $f; fi; done; $reset; done } _init_completion () { local exclude="" flag outx errx inx OPTIND=1; while getopts "n:e:o:i:s" flag "$@"; do case $flag in n) exclude+=$OPTARG ;; e) errx=$OPTARG ;; o) outx=$OPTARG ;; i) inx=$OPTARG ;; s) split=false; exclude+== ;; *) echo "bash_completion: $FUNCNAME: usage error" 1>&2; return 1 ;; esac; done; COMPREPLY=(); local redir="@(?([0-9])<|?([0-9&])>?(>)|>&)"; _get_comp_words_by_ref -n "$exclude<>&" cur prev words cword; _variables && return 1; if [[ $cur == $redir* || ${prev-} == $redir ]]; then local xspec; case $cur in 2'>'*) xspec=${errx-} ;; *'>'*) xspec=${outx-} ;; *'<'*) xspec=${inx-} ;; *) case $prev in 2'>'*) xspec=${errx-} ;; *'>'*) xspec=${outx-} ;; *'<'*) xspec=${inx-} ;; esac ;; esac; cur="${cur##$redir}"; _filedir $xspec; return 1; fi; local i skip; for ((i = 1; i < ${#words[@]}; 1)) do if [[ ${words[i]} == $redir* ]]; then [[ ${words[i]} == $redir ]] && skip=2 || skip=1; words=("${words[@]:0:i}" "${words[@]:i+skip}"); ((i <= cword)) && ((cword -= skip)); else ((i++)); fi; done; ((cword <= 0)) && return 1; prev=${words[cword - 1]}; [[ -n ${split-} ]] && _split_longopt && split=true; return 0 } _installed_modules () { COMPREPLY=($(compgen -W "$(PATH="$PATH:/sbin" lsmod | awk '{if (NR != 1) print $1}')" -- "$1")) } _ip_addresses () { local n; case ${1-} in -a) n='6\?' ;; -6) n='6' ;; *) n= ;; esac; local PATH=$PATH:/sbin; local addrs=$({ LC_ALL=C ifconfig -a || ip addr show } 2>/dev/null | command sed -e 's/[[:space:]]addr:/ /' -ne "s|.*inet${n}[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p"); COMPREPLY+=($(compgen -W "$addrs" -- "${cur-}")) } _itwebsettings () { local cur prev opts base; cur="${COMP_WORDS[COMP_CWORD]}"; prev="${COMP_WORDS[COMP_CWORD-1]}"; opts="-help -list -get -info -set -reset -reset -headless -check -verbose"; COMPREPLY=($(compgen -W "${opts}" -- ${cur})); return 0 } _javaws () { local cur prev opts base; cur="${COMP_WORDS[COMP_CWORD]}"; prev="${COMP_WORDS[COMP_CWORD-1]}"; opts="-version -arg -param -property -update -verbose -nosecurity -noupdate -headless -strict -xml -allowredirect -Xnofork -Xignoreheaders -Xoffline -Xtrustnone -jnlp -html -browser -about -viewer -Xclearcache -Xcacheids -license -help -Xtrustall"; if [[ $prev == *"-jnlp" || $prev == *"-html" ]]; then COMPREPLY=($(compgen -f -X "!*" -- ${cur})); if [ -d "$COMPREPLY" ]; then COMPREPLY="$COMPREPLY/"; fi; return 0; fi; if [[ $cur == "" ]]; then COMPREPLY=($(compgen -W "aa_file_or_url ${opts} zz_file_or_url" -- ${cur})); return 0; fi; if [[ $cur == "-"* ]]; then COMPREPLY=($(compgen -W "${opts}" -- ${cur})); return 0; else COMPREPLY=($(compgen -f -X "!*" -- ${cur})); if [ -d "$COMPREPLY" ]; then COMPREPLY="$COMPREPLY/"; fi; return 0; fi } _kernel_versions () { COMPREPLY=($(compgen -W '$(command ls /lib/modules)' -- "$cur")) } _kernels () { COMPREPLY=($( command ls /lib/modules | grep "^$cur" )) } _known_hosts () { local cur prev words cword; _init_completion -n : || return; local options; [[ ${1-} == -a || ${2-} == -a ]] && options=-a; [[ ${1-} == -c || ${2-} == -c ]] && options+=" -c"; _known_hosts_real ${options-} -- "$cur" } _known_hosts_real () { local configfile flag prefix="" ifs=$IFS; local cur suffix="" aliases i host ipv4 ipv6; local -a kh tmpkh=() khd=() config=(); local OPTIND=1; while getopts "ac46F:p:" flag "$@"; do case $flag in a) aliases='yes' ;; c) suffix=':' ;; F) configfile=$OPTARG ;; p) prefix=$OPTARG ;; 4) ipv4=1 ;; 6) ipv6=1 ;; *) echo "bash_completion: $FUNCNAME: usage error" 1>&2; return 1 ;; esac; done; if (($# < OPTIND)); then echo "bash_completion: $FUNCNAME: missing mandatory argument CWORD" 1>&2; return 1; fi; cur=${!OPTIND}; ((OPTIND += 1)); if (($# >= OPTIND)); then echo "bash_completion: $FUNCNAME($*): unprocessed arguments:" "$(while (($# >= OPTIND)); do printf '%s ' ${!OPTIND} shift done)" 1>&2; return 1; fi; [[ $cur == *@* ]] && prefix=$prefix${cur%@*}@ && cur=${cur#*@}; kh=(); if [[ -v configfile ]]; then [[ -r $configfile ]] && config+=("$configfile"); else for i in /etc/ssh/ssh_config ~/.ssh/config ~/.ssh2/config; do [[ -r $i ]] && config+=("$i"); done; fi; local reset=$(shopt -po noglob); set -o noglob; if ((${#config[@]} > 0)); then for i in "${config[@]}"; do _included_ssh_config_files "$i"; done; fi; if ((${#config[@]} > 0)); then local IFS=' '; tmpkh=($(awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u)); IFS=$ifs; fi; if ((${#tmpkh[@]} != 0)); then local j; for i in "${tmpkh[@]}"; do while [[ $i =~ ^([^\"]*)\"([^\"]*)\"(.*)$ ]]; do i=${BASH_REMATCH[1]}${BASH_REMATCH[3]}; j=${BASH_REMATCH[2]}; __expand_tilde_by_ref j; [[ -r $j ]] && kh+=("$j"); done; for j in $i; do __expand_tilde_by_ref j; [[ -r $j ]] && kh+=("$j"); done; done; fi; if [[ ! -v configfile ]]; then for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts ~/.ssh/known_hosts2; do [[ -r $i ]] && kh+=("$i"); done; for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do [[ -d $i ]] && khd+=("$i"/*pub); done; fi; if ((${#kh[@]} + ${#khd[@]} > 0)); then if ((${#kh[@]} > 0)); then for i in "${kh[@]}"; do while read -ra tmpkh; do ((${#tmpkh[@]} == 0)) && continue; set -- "${tmpkh[@]}"; [[ $1 == [\|\#]* ]] && continue; [[ $1 == @* ]] && shift; local IFS=,; for host in $1; do [[ $host == *[*?]* ]] && continue; host="${host#[}"; host="${host%]?(:+([0-9]))}"; COMPREPLY+=($host); done; IFS=$ifs; done < "$i"; done; COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")); fi; if ((${#khd[@]} > 0)); then for i in "${khd[@]}"; do if [[ $i == *key_22_$cur*.pub && -r $i ]]; then host=${i/#*key_22_/}; host=${host/%.pub/}; COMPREPLY+=($host); fi; done; fi; for i in ${!COMPREPLY[*]}; do COMPREPLY[i]=$prefix${COMPREPLY[i]}$suffix; done; fi; if [[ ${#config[@]} -gt 0 && -v aliases ]]; then local -a hosts=($(command sed -ne 's/^[[:blank:]]*[Hh][Oo][Ss][Tt][[:blank:]]\(.*\)$/\1/p' "${config[@]}")); if ((${#hosts[@]} != 0)); then COMPREPLY+=($(compgen -P "$prefix" -S "$suffix" -W '${hosts[@]%%[*?%]*}' -X '\!*' -- "$cur")); fi; fi; if [[ -n ${COMP_KNOWN_HOSTS_WITH_AVAHI-} ]] && type avahi-browse &> /dev/null; then COMPREPLY+=($(compgen -P "$prefix" -S "$suffix" -W "$(avahi-browse -cpr _workstation._tcp 2>/dev/null | awk -F';' '/^=/ { print $7 }' | sort -u)" -- "$cur")); fi; if type ruptime &> /dev/null; then COMPREPLY+=($(compgen -W "$(ruptime 2>/dev/null | awk '!/^ruptime:/ { print $1 }')" -- "$cur")); fi; if [[ -n ${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1} ]]; then COMPREPLY+=($(compgen -A hostname -P "$prefix" -S "$suffix" -- "$cur")); fi; $reset; if [[ -v ipv4 ]]; then COMPREPLY=("${COMPREPLY[@]/*:*$suffix/}"); fi; if [[ -v ipv6 ]]; then COMPREPLY=("${COMPREPLY[@]/+([0-9]).+([0-9]).+([0-9]).+([0-9])$suffix/}"); fi; if [[ -v ipv4 || -v ipv6 ]]; then for i in "${!COMPREPLY[@]}"; do [[ -n ${COMPREPLY[i]} ]] || unset -v "COMPREPLY[i]"; done; fi; __ltrim_colon_completions "$prefix$cur" } _longopt () { local cur prev words cword split; _init_completion -s || return; case "${prev,,}" in --help | --usage | --version) return ;; --!(no-*)dir*) _filedir -d; return ;; --!(no-*)@(file|path)*) _filedir; return ;; --+([-a-z0-9_])) local argtype=$(LC_ALL=C $1 --help 2>&1 | command sed -ne "s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p"); case ${argtype,,} in *dir*) _filedir -d; return ;; *file* | *path*) _filedir; return ;; esac ;; esac; $split && return; if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W "$(LC_ALL=C $1 --help 2>&1 | while read -r line; do [[ $line =~ --[A-Za-z0-9]+([-_][A-Za-z0-9]+)*=? ]] && printf '%s\n' ${BASH_REMATCH[0]} done)" -- "$cur")); [[ ${COMPREPLY-} == *= ]] && compopt -o nospace; else if [[ $1 == *@(rmdir|chroot) ]]; then _filedir -d; else [[ $1 == *mkdir ]] && compopt -o nospace; _filedir; fi; fi } _lyx () { local cur g last; shopt -q extglob && g=1; test $g -eq 0 && shopt -s extglob; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; local dbg_cmds=("none info init key gui parser lyxrc kbmap latex mathed font tclass lyxvc lyxserver action lyxlex depend insets files workarea clipboard graphics changes external painting debug any undo scrolling macros rtl locale selection find"); if [[ $COMP_CWORD > 1 ]]; then last=${COMP_WORDS[$(($COMP_CWORD - 1))]}; else last=''; fi; case "$last" in --export | -e) _filedir '+(pdf[1234]|PDF[1234]|pdf|PDF|ps|PS|xhtml|XHTML)' ;; -dbg) if [[ $cur == *,* ]]; then COMPREPLY=($( compgen -W '$dbg_cmds' -P ${cur%,*}, -- ${cur##*,} )); else COMPREPLY=($( compgen -W '$dbg_cmds' -- $cur )); fi ;; --force-overwrite | -f) COMPREPLY=($( compgen -W 'all main none' -- $cur )) ;; *) case "$cur" in -*) COMPREPLY=($( compgen -W '-help -userdir -sysdir \ -geometry -dbg -x --execute -e --export \ -i --import -version -batch -E --export-to \ -f --force-overwrite -n --no-remote \ -r --remote ' -- $cur )) ;; *) _filedir '@(lyx)' ;; esac ;; esac; test $g -eq 0 && shopt -u extglob } _mac_addresses () { local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'; local PATH="$PATH:/sbin:/usr/sbin"; COMPREPLY+=($( { LC_ALL=C ifconfig -a || ip link show } 2>/dev/null | command sed -ne "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]].*/\1/p" -ne "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" -ne "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]].*|\2|p" -ne "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]]*$|\2|p" )); COMPREPLY+=($({ arp -an || ip neigh show } 2>/dev/null | command sed -ne "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p")); COMPREPLY+=($(command sed -ne "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null)); COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")); __ltrim_colon_completions "$cur" } _minimal () { local cur prev words cword split; _init_completion -s || return; $split && return; _filedir } _modules () { local modpath; modpath=/lib/modules/$1; COMPREPLY=($(compgen -W "$(command ls -RL $modpath 2>/dev/null | command sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p')" -- "$cur")) } _ncpus () { local var=NPROCESSORS_ONLN; [[ $OSTYPE == *linux* ]] && var=_$var; local n=$(getconf $var 2>/dev/null); printf %s ${n:-1} } _ndiswrapper () { local cur prev pprev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [ $COMP_CWORD -gt 1 ]; then pprev=${COMP_WORDS[COMP_CWORD-2]}; case $pprev in -d) _ndiswrapper_drivers; return 0 ;; esac; fi; case $prev in -i) _filedir; return 0 ;; -d) _pci_ids; _usb_ids; return 0 ;; -e) _ndiswrapper_drivers; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-i -d -e -l -m -hotplug' -- $cur )); fi } _ndiswrapper_drivers () { COMPREPLY=($( ndiswrapper -l | awk '/driver present/ {print $1}' |grep "^$cur" )) } _netprofile () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; COMPREPLY=($( command ls /etc/netprofile/profiles | grep "^$cur" )) } _ninja_target () { local cur prev targets dir line targets_command OPTIND; if _get_comp_words_by_ref cur prev &> /dev/null; then case $prev in -f) _filedir; return 0 ;; -C) _filedir -d; return 0 ;; esac; else cur="${COMP_WORDS[COMP_CWORD]}"; fi; if [[ "$cur" == "--"* ]]; then COMPREPLY=($(compgen -P '--' -W 'version' -- "${cur:2}")); else dir="."; line=$(echo ${COMP_LINE} | cut -d" " -f 2-); while getopts :C:f:j:l:k:nvd:t: opt $line; do case $opt in C) eval dir="$OPTARG" ;; esac; done; targets_command="eval ninja -C \"${dir}\" -t targets all 2>/dev/null | cut -d: -f1"; COMPREPLY=($(compgen -W '`${targets_command}`' -- "$cur")); fi; return } _parse_help () { eval local cmd="$(quote "$1")"; local line; { case $cmd in -) cat ;; *) LC_ALL=C "$(dequote "$cmd")" ${2:---help} 2>&1 ;; esac } | while read -r line; do [[ $line == *([[:blank:]])-* ]] || continue; while [[ $line =~ ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+([,_-]+[A-Z0-9]+)?(\.\.+)?\]? ]]; do line=${line/"${BASH_REMATCH[0]}"/"${BASH_REMATCH[1]}"}; done; __parse_options "${line// or /, }"; done } _parse_usage () { eval local cmd="$(quote "$1")"; local line match option i char; { case $cmd in -) cat ;; *) LC_ALL=C "$(dequote "$cmd")" ${2:---usage} 2>&1 ;; esac } | while read -r line; do while [[ $line =~ \[[[:space:]]*(-[^]]+)[[:space:]]*\] ]]; do match=${BASH_REMATCH[0]}; option=${BASH_REMATCH[1]}; case $option in -?(\[)+([a-zA-Z0-9?])) for ((i = 1; i < ${#option}; i++)) do char=${option:i:1}; [[ $char != '[' ]] && printf '%s\n' -$char; done ;; *) __parse_options "$option" ;; esac; line=${line#*"$match"}; done; done } _pci_ids () { COMPREPLY+=($(compgen -W "$(PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur")) } _pgids () { COMPREPLY=($(compgen -W '$(command ps axo pgid=)' -- "$cur")) } _pids () { COMPREPLY=($(compgen -W '$(command ps axo pid=)' -- "$cur")) } _pnames () { local -a procs; if [[ ${1-} == -s ]]; then procs=($(command ps axo comm | command sed -e 1d)); else local line i=-1 ifs=$IFS; IFS=' '; local -a psout=($(command ps axo command=)); IFS=$ifs; for line in "${psout[@]}"; do if ((i == -1)); then if [[ $line =~ ^(.*[[:space:]])COMMAND([[:space:]]|$) ]]; then i=${#BASH_REMATCH[1]}; else break; fi; else line=${line:i}; line=${line%% *}; procs+=($line); fi; done; if ((i == -1)); then for line in "${psout[@]}"; do if [[ $line =~ ^[[(](.+)[])]$ ]]; then procs+=(${BASH_REMATCH[1]}); else line=${line%% *}; line=${line##@(*/|-)}; procs+=($line); fi; done; fi; fi; COMPREPLY=($(compgen -X "<defunct>" -W '${procs[@]}' -- "$cur")) } _policyeditor () { local cur prev opts base; cur="${COMP_WORDS[COMP_CWORD]}"; prev="${COMP_WORDS[COMP_CWORD-1]}"; opts="-help -file -defaultfile -codebase -signedby -principals -verbose"; COMPREPLY=($(compgen -W "${opts}" -- ${cur})); return 0 } _python_django_completion () { if [[ ${COMP_CWORD} -ge 2 ]]; then local PYTHON_EXE=${COMP_WORDS[0]##*/}; if echo "$PYTHON_EXE" | grep -qE "python([3-9]\.[0-9])?"; then local PYTHON_SCRIPT=${COMP_WORDS[1]##*/}; if echo "$PYTHON_SCRIPT" | grep -qE "manage\.py|django-admin(\.py)?"; then COMPREPLY=($( COMP_WORDS=( "${COMP_WORDS[*]:1}" ) COMP_CWORD=$(( COMP_CWORD-1 )) DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} )); fi; fi; fi } _quote_readline_by_ref () { if [ -z "$1" ]; then printf -v $2 %s "$1"; else if [[ $1 == \'* ]]; then printf -v $2 %s "${1:1}"; else if [[ $1 == ~* ]]; then printf -v $2 ~%q "${1:1}"; else printf -v $2 %q "$1"; fi; fi; fi; [[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}"; [[ ${!2} == \$* ]] && eval $2=${!2} } _realcommand () { type -P "$1" > /dev/null && { if type -p realpath > /dev/null; then realpath "$(type -P "$1")"; else if type -p greadlink > /dev/null; then greadlink -f "$(type -P "$1")"; else if type -p readlink > /dev/null; then readlink -f "$(type -P "$1")"; else type -P "$1"; fi; fi; fi } } _rl_enabled () { [[ "$(bind -v)" == *$1+([[:space:]])on* ]] } _root_command () { local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin; local root_command=$1; _command } _service () { local cur prev words cword; _init_completion || return; ((cword > 2)) && return; if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then _services; [[ -e /etc/mandrake-release ]] && _xinetd_services; else local sysvdirs; _sysvdirs; COMPREPLY=($(compgen -W '`command sed -e "y/|/ /" \ -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \ ${sysvdirs[0]}/${prev##*/} 2>/dev/null` start stop' -- "$cur")); fi } _services () { local sysvdirs; _sysvdirs; local IFS=' ' reset=$(shopt -p nullglob); shopt -s nullglob; COMPREPLY=($(printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions|README))); $reset; COMPREPLY+=($({ systemctl list-units --full --all || systemctl list-unit-files } 2>/dev/null | awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }')); if [[ -x /sbin/upstart-udev-bridge ]]; then COMPREPLY+=($(initctl list 2>/dev/null | cut -d' ' -f1)); fi; COMPREPLY=($(compgen -W '${COMPREPLY[@]#${sysvdirs[0]}/}' -- "$cur")) } _shells () { local shell rest; while read -r shell rest; do [[ $shell == /* && $shell == "$cur"* ]] && COMPREPLY+=($shell); done 2> /dev/null < /etc/shells } _signals () { local -a sigs=($(compgen -P "${1-}" -A signal "SIG${cur#${1-}}")); COMPREPLY+=("${sigs[@]/#${1-}SIG/${1-}}") } _source_highlight () { local cur prev opts; COMPREPLY=(); cur="${COMP_WORDS[COMP_CWORD]}"; prev="${COMP_WORDS[COMP_CWORD-1]}"; opts="-h --help -V --version -i --input -o --output -s --src-lang --lang-list --outlang-list -f --out-format -d --doc --no-doc -c --css -T --title -t --tab -H --header -F --footer --style-file --outlang-def --outlang-map --data-dir --output-dir --lang-def --lang-map --show-lang-elements --infer-lang -n --line-number --line-number-ref --line-range --range-separator --range-context --regex-range --gen-references --ctags-file --ctags -v --verbose --statistics --gen-version --check-lang --check-outlang --failsafe -g --debug-langdef --show-regex"; if [[ "${cur}" == -* || ${COMP_CWORD} -eq 1 ]]; then COMPREPLY=($(compgen -W "${opts}" -- "${cur}")); return 0; fi; case "${prev}" in -T | --title | -t | --tab | --gen-references | --line-range | --range-separator | --range-context | --regex-range) COMPREPLY=() ;; -i | --input | -o | --output | -c | --css | -H | --header | -F | --footer | --style-file | --outlang-def | --outlang-map | --lang-def | --lang-map | --show-lang-elements | --ctags-file | --check-lang | --check-outlang | --show-regex) COMPREPLY=($(compgen -A file -- "${cur}")) ;; -s | --src-lang) COMPREPLY=($(compgen -W "C H ac ada am applescript asm autoconf awk bat bib bison c caml cc changelog clipper cls cobol conf cpp cs csh csharp css d diff docbook dtx el eps erlang fixed-fortran flex fortran free-fortran glsl h haskell haxe hh hpp htm html hx in ini islisp java javalog javascript js kcfg kdevelop kidl ksh l lang langdef latex ldap ldif lex lgt lilypond lisp ll log logtalk lsm lua m4 manifest ml mli moc opa outlang oz pas pascal patch pc perl php php3 php4 php5 pl pm po pot postscript prolog properties proto ps py python rb rc ruby scala scheme sh shell sig sl slang slsh sml spec sql sty style syslog tcl tcsh texinfo tex tk tml txt ui upc vala vbscript xhtml xml xorg y yacc yy" -- "${cur}")) ;; -f | --out-format) COMPREPLY=($(compgen -W "docbook esc html html-css htmltable javadoc latex latexcolor odf texinfo xhtml xhtml-css xhtmltable" -- "${cur}")) ;; --data-dir | --output-dir) COMPREPLY=($(compgen -A directory -- "${cur}")) ;; *) COMPREPLY=($(compgen -W "${opts/${preprev}}" -- "${cur}")) ;; esac } _split_longopt () { if [[ $cur == --?*=* ]]; then prev="${cur%%?(\\)=*}"; cur="${cur#*=}"; return 0; fi; return 1 } _subdirectories () { COMPREPLY=($( command ls -F $1 2>/dev/null | awk -F \/ '/\/$/ \ {print $1}' | grep "^$cur" )) } _svn () { local cur cmds cmdOpts pOpts mOpts rOpts qOpts nOpts optsParam opt; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; cmds='add auth blame annotate praise cat changelist cl checkout co cleanup'; cmds="$cmds commit ci copy cp delete remove rm diff export help import"; cmds="$cmds info list ls lock log merge mergeinfo mkdir move mv rename"; cmds="$cmds patch propdel pdel propedit pedit propget pget proplist"; cmds="$cmds plist propset pset relocate resolve resolved revert status"; cmds="$cmds switch unlock update upgrade"; cmds="$cmds x-shelf-diff x-shelf-drop x-shelf-list x-shelf-list-by-paths"; cmds="$cmds x-shelf-log x-shelf-save x-shelve x-shelves x-unshelve"; local helpOpts='--help -h'; local specOpts="--version $helpOpts"; optsParam="-r|--revision|--username|--password|--targets"; optsParam="$optsParam|-x|--extensions|-m|--message|-F|--file"; optsParam="$optsParam|--encoding|--diff-cmd|--diff3-cmd|--editor-cmd"; optsParam="$optsParam|--old|--new|--config-dir|--config-option"; optsParam="$optsParam|--native-eol|-l|--limit|-c|--change"; optsParam="$optsParam|--depth|--set-depth|--with-revprop"; optsParam="$optsParam|--cl|--changelist|--accept|--show-revs"; optsParam="$optsParam|--show-item"; local svnProps revProps allProps psCmds propCmds; svnProps="svn:keywords svn:executable svn:needs-lock svn:externals svn:ignore svn:eol-style svn:mime-type $SVN_BASH_FILE_PROPS"; revProps="svn:author svn:log svn:date $SVN_BASH_REV_PROPS"; allProps=($svnProps $revProps); psCmds='propset|pset|ps'; propCmds="$psCmds|propget|pget|pg|propedit|pedit|pe|propdel|pdel|pd"; local urlSchemas='file:/// http:// https:// svn:// svn+ssh://'; local cmd= isPropCmd= isPsCmd= isHelpCmd= nExpectArgs= isCur= i=0; local prev= help= prop= val= isRevProp= last='none' nargs=0 stat=; local options= hasRevPropOpt= hasRevisionOpt= hasRelocateOpt=; local acceptOpt= URL= hasReintegrateOpt=; for opt in "${COMP_WORDS[@]}"; do [[ -n $isCur ]] && stat=$last; isCur=; [[ $i -eq $COMP_CWORD ]] && isCur=1; let i++; [ $last = 'none' ] && { last='first'; continue }; if [[ $prev == @($optsParam) ]]; then [[ $prev = '--accept' ]] && acceptOpt=$opt; prev=''; last='skip'; continue; fi; if [[ $prev == @(<|>|>>|[12]>|[12]>>) ]]; then prev=''; last='skip'; continue; fi; prev=$opt; if [[ ! -n $cmd && -n $opt && ( $opt != -* || $opt == @(${specOpts// /|}) ) ]]; then cmd=$opt; [[ $cmd == @($propCmds) ]] && isPropCmd=1; [[ $cmd == @($psCmds) ]] && isPsCmd=1; [[ $cmd == @(${helpOpts// /|}) ]] && cmd='help'; [[ $cmd = 'help' ]] && isHelpCmd=1; if [[ -n $isHelpCmd && -n $cmd && $cmd != 'help' && ! -n $help ]]; then help=$cmd; cmd='help'; fi; last='cmd'; continue; fi; if [[ -n $isHelpCmd && ! -n $help && -n $opt && $opt != -* ]]; then help=$opt; last='help'; continue; fi; if [[ -n $isPropCmd && ! -n $prop && -n $opt && $opt != -* ]]; then prop=$opt; [[ $prop == @(${revProps// /|}) ]] && isRevProp=1; last='prop'; continue; fi; if [[ -n $isPsCmd && -n $prop && ! -n $val && $opt != -* ]]; then val=$opt; last='val'; continue; fi; if [[ $last != 'onlyarg' ]]; then case $opt in -r | --revision | --revision=*) hasRevisionOpt=1 ;; --revprop) hasRevPropOpt=1; allProps=($revProps); nExpectArgs=1 ;; -h | --help) isHelpCmd=1 ;; -F | --file) val='-F' ;; --relocate) hasRelocateOpt=1 ;; --reintegrate) hasReintegrateOpt=1 ;; esac; if [[ $opt = '--' && ! -n $isCur ]]; then last='onlyarg'; continue; fi; if [[ $opt == -* ]]; then [[ ! -n $isCur ]] && options="$options $opt "; last='opt'; continue; fi; else let nargs++; continue; fi; if [[ $cmd = 'merge' && ! -n $URL ]]; then URL=$opt; fi; last='arg'; let nargs++; done; [[ -n $stat ]] || stat=$last; if [[ ! -n $cmd || $stat = 'cmd' ]]; then COMPREPLY=($( compgen -W "$cmds $specOpts" -- $cur )); return 0; fi; if [[ $stat = 'help' || ( -n $isHelpCmd && ! -n $help ) ]]; then COMPREPLY=($( compgen -W "$cmds" -- $cur )); return 0; fi; if [[ $cmd == @(co|checkout|ls|list) && $stat = 'arg' && $SVN_BASH_COMPL_EXT == *urls* ]]; then if [[ $cmd == @(ls|list) ]]; then _svn_complete_target 'all' && return; else _svn_complete_target 'remote_only' && return; fi; fi; if [[ $cmd = 'merge' || $cmd = 'mergeinfo' ]]; then local here=$(_svn_info URL); if [[ ! -n $URL && $stat = 'arg' ]]; then if [[ "$here" == */branches/* ]]; then COMPREPLY=($(compgen -W ${here/\/branches\/*/\/trunk} -- $cur )); return 0; else if [[ "$here" == */trunk* ]]; then COMPREPLY=($(compgen -W ${here/\/trunk*/\/branches\/} -- $cur )); compopt -o nospace; return 0; else COMPREPLY=($(compgen -W $(_svn_info Root)/ -- $cur )); compopt -o nospace; return 0; fi; fi; else if [[ $URL == */branches/* && $here == */trunk* && ! -n $hasReintegrateOpt && $cur = '' && $stat = 'arg' ]]; then COMPREPLY=($(compgen -W '--reintegrate' -- $cur )); return 0; else _svn_complete_target 'all' && return; fi; fi; fi; if [[ $stat = 'skip' ]]; then local previous=${COMP_WORDS[COMP_CWORD-1]}; local values= dirs= beep= exes=; [[ $previous = '--config-dir' ]] && dirs=1; [[ $previous = --*-cmd ]] && exes=1; [[ $previous = '--native-eol' ]] && values='LF CR CRLF'; [[ $previous = '--limit' ]] && values='0 1 2 3 4 5 6 7 8 9'; [[ $previous = '--revision' || $previous = '-r' ]] && values='HEAD BASE PREV COMMITTED 0 {'; [[ $previous = '--encoding' ]] && values="latin1 utf8 $SVN_BASH_ENCODINGS"; [[ $previous = '--extensions' || $previous = '-x' ]] && values="--unified --ignore-space-change --ignore-all-space --ignore-eol-style --show-c-functions"; [[ $previous = '--depth' ]] && values='empty files immediates infinity'; [[ $previous = '--set-depth' ]] && values='empty exclude files immediates infinity'; [[ $previous = '--accept' ]] && { if [[ $cmd = 'resolve' ]]; then values='base working mine-full theirs-full'; else values="postpone base mine-full theirs-full edit launch mine-conflict theirs-conflict"; fi }; [[ $previous = '--show-revs' ]] && values='merged eligible'; [[ $previous = '--show-item' ]] && values="kind url relative-url repos-root-url repos-uuid revision last-changed-revision last-changed-date last-changed-author wc-root"; if [[ $previous = '--username' ]]; then values="$SVN_BASH_USERNAME"; if [[ $SVN_BASH_COMPL_EXT == *username* ]]; then local file=; for file in ~/.subversion/auth/svn.simple/*; do if [ -r $file ]; then values="$values $(_svn_read_hashfile username < $file)"; fi; done; fi; [[ ! -n "$values" ]] && beep=1; fi; [[ $previous = '--password' ]] && beep=1; [[ -n $values ]] && COMPREPLY=($( compgen -W "$values" -- $cur )); [[ -n $dirs ]] && COMPREPLY=($( compgen -o dirnames -- $cur )); [[ -n $exes ]] && COMPREPLY=($( compgen -c -- $cur )); [[ -n $beep ]] && { echo -en "\a"; COMPREPLY=('') }; return 0; fi; if [[ -n $isPropCmd && ( ! -n $prop || $stat = 'prop' ) && $cur != -* ]]; then local choices=; if [[ $cur == *:* ]]; then local prefix=${cur%:*} suffix=${cur#*:} c=; for c in ${allProps[@]}; do [[ $c == $prefix:* ]] && choices="$choices ${c#*:}"; done; cur=$suffix; else COMPREPLY=($( compgen -W "${allProps[*]}" -- $cur )); [ ${#COMPREPLY[@]} -eq 1 ] && return 0; local seen= n=0 last= c=; for c in ${allProps[@]%:*}; do if [[ $c == $cur* && ( ! -n $seen || $c != @($seen) ) ]]; then let n++; last=$c; choices="$choices $c:"; if [[ -n $seen ]]; then seen="$seen|$c*"; else seen="$c*"; fi; fi; done; [[ $n -eq 1 ]] && choices="$last:1 $last:2"; fi; COMPREPLY=($( compgen -W "$choices" -- $cur )); return 0; fi; if [[ -n $isRevProp && ! -n $hasRevPropOpt ]]; then COMPREPLY=($( compgen -W '--revprop' -- $cur )); return 0; fi; if [[ -n $isRevProp && -n $hasRevPropOpt && ! -n $hasRevisionOpt ]]; then COMPREPLY=($( compgen -W '--revision' -- $cur )); return 0; fi; if [[ -n $isPsCmd && -n $prop && ( ! -n $val || $stat = 'val' ) ]]; then local values="\' --file"; case $prop in svn:keywords) values="Id Rev URL Date Author Header \' $SVN_BASH_KEYWORDS" ;; svn:executable | svn:needs-lock) values='\\*' ;; svn:eol-style) values='native LF CR CRLF' ;; svn:mime-type) values="text/ text/plain text/html text/xml text/rtf image/ image/png image/gif image/jpeg image/tiff audio/ audio/midi audio/mpeg video/ video/mpeg video/mp4 application/ application/octet-stream $SVN_BASH_MIME_TYPE" ;; esac; COMPREPLY=($( compgen -W "$values" -- $cur )); [[ -n ${COMPREPLY} ]] && return 0; fi; case $cmd in merge) nExpectArgs=3 ;; mergeinfo) nExpectArgs=1 ;; copy | cp | move | mv | rename | ren | export | import) nExpectArgs=2 ;; switch | sw) [[ ! -n $hasRelocateOpt ]] && nExpectArgs=2 ;; help | h) nExpectArgs=0 ;; --version) nExpectArgs=0 ;; esac; if [[ -n $nExpectArgs && $nargs -gt $nExpectArgs ]]; then echo -en "\a"; COMPREPLY=(''); return 0; fi; if [[ $cur != -* || $stat = 'onlyarg' ]]; then if [[ $SVN_BASH_COMPL_EXT == *svnstatus* ]]; then local status='svn status --non-interactive'; [[ $SVN_BASH_COMPL_EXT == *recurse* ]] || status="$status --non-recursive"; [[ $SVN_BASH_COMPL_EXT == *externals* ]] || status="$status --ignore-externals"; local cs= files=; [[ -n $cur ]] && cs=$cur*; case $cmd in st*) files=$cur* ;; ci | commit | revert | di*) files=$($status $cs| _svn_grcut '@([MADR!]*| M*|_M*)') ;; add) files=$($status $cs| _svn_grcut '\?*') ;; unlock) files=$($status $cs| _svn_grcut '@(??L*|?????[KOTB]*)') ;; resolve*) files=$($status $cs| _svn_grcut '@(?C*|C*)') ;; praise | blame | ann*) files=$( _svn_lls all $cur* ) ;; p*) if [[ $cmd == @($propCmds) && $prop == @(svn:ignore|svn:externals) ]]; then files=$( _svn_lls dir . $cur* ); else files="$( _svn_lls all $cur* ) $($status $cs | _svn_grcut 'A*' )"; fi ;; info) files="$( _svn_lls all $cur* ) $($status $cs | _svn_grcut 'A*' )" ;; remove | rm | del* | move | mv | rename) files=$( _svn_lls all $cur* ) ;; mkdir) files=$( _svn_lls dir $cur* ) ;; log | lock | up* | cl* | switch) files=$( _svn_lls all $cur* ) ;; merge) files=$( _svn_lls all $cur* ) ;; ls | list) files=$( _svn_lls all $cur* ) ;; *) local fallback=1 ;; esac; if [[ $SVN_BASH_COMPL_EXT != *recurse* ]]; then files="$files $( _svn_lls dir $cur* )"; fi; if [[ -n $files ]]; then COMPREPLY=($( compgen -W "$files" -- $cur )); [[ -n "${COMPREPLY[*]}" ]] || COMPREPLY=(''); else if [[ ! -n $fallback ]]; then echo -en "\a"; COMPREPLY=(''); fi; fi; fi; return 0; fi; pOpts="--username --password --no-auth-cache --non-interactive --password-from-stdin --trust-server-cert-failures --force-interactive"; mOpts="-m --message -F --file --encoding --force-log --with-revprop --editor-cmd"; rOpts="-r --revision"; qOpts="-q --quiet"; nOpts="-N --non-recursive --depth"; gOpts="-g --use-merge-history"; cOpts="--cl --changelist"; cmdOpts=; case $cmd in --version) cmdOpts="$qOpts" ;; add) cmdOpts="--auto-props --no-auto-props --force --targets --no-ignore --parents $nOpts $qOpts $pOpts" ;; auth) cmdOpts="--remove --show-passwords $pOpts" ;; blame | annotate | ann | praise) cmdOpts="$rOpts $pOpts -v --verbose --incremental --xml -x --extensions --force $gOpts" ;; cat) cmdOpts="$rOpts $pOpts --ignore-keywords" ;; changelist | cl) cmdOpts="--targets $pOpts $qOpts $cOpts -R --recursive --depth --remove" ;; checkout | co) cmdOpts="$rOpts $qOpts $nOpts $pOpts --ignore-externals --force" ;; cleanup) cmdOpts="$pOpts --include-externals -q --quiet --remove-ignored --remove-unversioned --vacuum-pristines" ;; commit | ci) cmdOpts="$mOpts $qOpts $nOpts --targets $pOpts --no-unlock $cOpts --keep-changelists --include-externals" ;; copy | cp) cmdOpts="$mOpts $rOpts $qOpts $pOpts --parents --ignore-externals --pin-externals" ;; delete | del | remove | rm) cmdOpts="--force $mOpts $qOpts --targets $pOpts --keep-local" ;; diff | di) cmdOpts="$rOpts -x --extensions --diff-cmd --no-diff-deleted $nOpts $pOpts --force --old --new --notice-ancestry -c --change --summarize $cOpts --xml --git --internal-diff --show-copies-as-adds --ignore-properties --properties-only --no-diff-added --patch-compatible" ;; export) cmdOpts="$rOpts $qOpts $pOpts $nOpts --force --native-eol --ignore-externals --ignore-keywords" ;; help | h | \?) cmdOpts= ;; import) cmdOpts="--auto-props --no-auto-props $mOpts $qOpts $nOpts --no-ignore $pOpts --force" ;; info) cmdOpts="$pOpts $rOpts --targets -R --recursive --depth --include-externals --incremental --xml --show-item --no-newline $cOpts" ;; list | ls) cmdOpts="$rOpts -v --verbose -R --recursive $pOpts --incremental --search --xml --depth --include-externals" ;; lock) cmdOpts="-m --message -F --file --encoding --force-log $qOpts --targets --force $pOpts" ;; log) cmdOpts="$rOpts -v --verbose --targets $pOpts --stop-on-copy --incremental --xml $qOpts -l --limit -c --change $gOpts --with-all-revprops --with-revprop --depth --diff --diff-cmd -x --extensions --internal-diff --with-no-revprops --search --search-and" ;; merge) cmdOpts="$rOpts $nOpts $qOpts --force --dry-run --diff3-cmd $pOpts --ignore-ancestry -c --change -x --extensions --record-only --accept --allow-mixed-revisions -v --verbose" ;; mergeinfo) cmdOpts="$rOpts $pOpts --depth --show-revs -R --recursive $qOpts -v --verbose --incremental --log" ;; mkdir) cmdOpts="$mOpts $qOpts $pOpts --parents" ;; move | mv | rename | ren) cmdOpts="$mOpts $qOpts --force $pOpts --parents --allow-mixed-revisions" ;; patch) cmdOpts="$qOpts $pOpts --dry-run --ignore-whitespace --reverse-diff --strip" ;; propdel | pdel | pd) cmdOpts="$qOpts -R --recursive $rOpts $pOpts $cOpts --depth"; [[ -n $isRevProp || ! -n $prop ]] && cmdOpts="$cmdOpts --revprop" ;; propedit | pedit | pe) cmdOpts="$pOpts $mOpts --force"; [[ -n $isRevProp || ! -n $prop ]] && cmdOpts="$cmdOpts --revprop $rOpts" ;; propget | pget | pg) cmdOpts="-v --verbose -R --recursive $rOpts --no-newline $pOpts $cOpts --depth --xml --show-inherited-props"; [[ -n $isRevProp || ! -n $prop ]] && cmdOpts="$cmdOpts --revprop" ;; proplist | plist | pl) cmdOpts="-v --verbose -R --recursive $rOpts --revprop $qOpts $pOpts $cOpts --depth --xml --show-inherited-props" ;; propset | pset | ps) cmdOpts="$qOpts --targets -R --recursive --encoding $pOpts --force $cOpts --depth"; [[ -n $isRevProp || ! -n $prop ]] && cmdOpts="$cmdOpts --revprop $rOpts"; [[ -n $val ]] || cmdOpts="$cmdOpts -F --file" ;; relocate) cmdOpts="--ignore-externals $pOpts" ;; resolve) cmdOpts="--targets -R --recursive $qOpts $pOpts --accept --depth" ;; resolved) cmdOpts="--targets -R --recursive $qOpts $pOpts --depth" ;; revert) cmdOpts="--targets -R --recursive $qOpts $cOpts --depth $pOpts" ;; status | stat | st) cmdOpts="-u --show-updates -v --verbose $nOpts $qOpts $pOpts --no-ignore --ignore-externals --incremental --xml $rOpts $cOpts" ;; switch | sw) cmdOpts="$rOpts $nOpts $qOpts $pOpts --diff3-cmd --force --accept --ignore-externals --set-depth --ignore-ancestry" ;; unlock) cmdOpts="$qOpts --targets --force $pOpts" ;; update | up) cmdOpts="$rOpts $nOpts $qOpts $pOpts --diff3-cmd --ignore-externals --force --accept $cOpts --parents --editor-cmd --set-depth --adds-as-modification" ;; upgrade) cmdOpts="$qOpts $pOpts" ;; x-shelf-list-by-paths) cmdOpts="$pOpts" ;; x-shelf-diff) cmdOpts="$pOpts --summarize" ;; x-shelf-drop) cmdOpts="$pOpts" ;; x-shelf-list | x-shelves) cmdOpts="$qOpts $pOpts" ;; x-shelf-log) cmdOpts="$qOpts $pOpts" ;; x-shelf-save) cmdOpts="--dry-run --depth --targets $cOpts $mOpts $qOpts $pOpts" ;; x-shelve) cmdOpts="--keep-local --dry-run --depth --targets $cOpts $mOpts $qOpts $pOpts" ;; x-unshelve) cmdOpts="--drop --dry-run $qOpts $pOpts" ;; *) ;; esac; [[ "$cmd" != "--version" ]] && cmdOpts="$cmdOpts $helpOpts"; cmdOpts="$cmdOpts --config-dir --config-option"; if [[ $acceptOpt == @(edit|launch) ]]; then cmdOpts=${cmdOpts/ --non-interactive / }; fi; for opt in $options; do local optBase; case $opt in --*) optBase=${opt/=*/} ;; -*) optBase=${opt:0:2} ;; esac; cmdOpts=" $cmdOpts "; cmdOpts=${cmdOpts/ ${optBase} / }; case $optBase in -v) cmdOpts=${cmdOpts/ --verbose / } ;; --verbose) cmdOpts=${cmdOpts/ -v / } ;; -N) cmdOpts=${cmdOpts/ --non-recursive / } ;; --non-recursive) cmdOpts=${cmdOpts/ -N / } ;; -R) cmdOpts=${cmdOpts/ --recursive / } ;; --recursive) cmdOpts=${cmdOpts/ -R / } ;; -x) cmdOpts=${cmdOpts/ --extensions / } ;; --extensions) cmdOpts=${cmdOpts/ -x / } ;; -q) cmdOpts=${cmdOpts/ --quiet / } ;; --quiet) cmdOpts=${cmdOpts/ -q / } ;; -h) cmdOpts=${cmdOpts/ --help / } ;; --help) cmdOpts=${cmdOpts/ -h / } ;; -l) cmdOpts=${cmdOpts/ --limit / } ;; --limit) cmdOpts=${cmdOpts/ -l / } ;; -r) cmdOpts=${cmdOpts/ --revision / } ;; --revision) cmdOpts=${cmdOpts/ -r / } ;; -c) cmdOpts=${cmdOpts/ --change / } ;; --change) cmdOpts=${cmdOpts/ -c / } ;; --auto-props) cmdOpts=${cmdOpts/ --no-auto-props / } ;; --no-auto-props) cmdOpts=${cmdOpts/ --auto-props / } ;; -g) cmdOpts=${cmdOpts/ --use-merge-history / } ;; --use-merge-history) cmdOpts=${cmdOpts/ -g / } ;; -m | --message | -F | --file) cmdOpts=${cmdOpts/ --message / }; cmdOpts=${cmdOpts/ -m / }; cmdOpts=${cmdOpts/ --file / }; cmdOpts=${cmdOpts/ -F / } ;; esac; if [ $isHelpCmd ]; then cmdOpts=${cmdOpts/ -h / }; cmdOpts=${cmdOpts/ --help / }; fi; done; COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); return 0 } _svn_complete_target () { local prefix=${COMP_WORDS[COMP_CWORD-2]}; local colon=${COMP_WORDS[COMP_CWORD-1]}; if [[ $prefix == "file" && "$colon" == ":" ]]; then COMPREPLY=($(compgen -d -S '/' -X '*/.*' -- $cur )); return; else if [[ ( $1 == "all" && $cur == ^/* ) || ( "$colon" == ":" && $cur == //*/* ) ]]; then local p; if [ "$colon" == ":" ]; then p="$prefix$colon"; fi; if [[ $cur =~ ((.*/)([^/]*)) ]]; then local url="${BASH_REMATCH[2]}"; local path="${BASH_REMATCH[3]}"; local remote_files="$(svn ls --non-interactive "$p$url" 2> /dev/null )"; COMPREPLY=($(compgen -P "$url" -W "$remote_files" -- "$path" )); compopt -o nospace; return 0; fi; else if [[ "$colon" == ":" ]]; then if [[ $prefix == "svn+ssh" && $cur =~ (^//(.*)) ]]; then local server_start=${BASH_REMATCH[2]}; local suffix=/; _known_hosts_real -p // "$server_start"; else local urls= file=; for file in ~/.subversion/auth/svn.simple/*; do if [ -r $file ]; then local url=$(_svn_read_hashfile svn:realmstring < $file); url=${url/*</}; url=${url/>*/}; urls="$urls $url"; fi; done; local suffix=$cur c= choices=; for c in $urls; do [[ $c == $prefix:* ]] && choices="$choices ${c#*:}"; done; COMPREPLY=($(compgen -W "$choices" -- $suffix )); fi; compopt -o nospace; return; else if [ $1 == 'all' ]; then COMPREPLY=($(compgen -W "^/ $urlSchemas" -- $cur)); else COMPREPLY=($(compgen -W "$urlSchemas" -- $cur)); fi; compopt -o nospace; return; fi; fi; fi; return 1 } _svn_grcut () { local re=$1 line= old_IFS; old_IFS="$IFS"; IFS=' '; while read -r line; do [[ ! -n $re || $line == $re ]] && echo "${line/????????/}"; done; IFS="$old_IFS" } _svn_info () { local what=$1 line=; LANG=C LC_MESSAGES=C svn info --non-interactive 2> /dev/null | while read line; do [[ $line == *"$what: "* ]] && echo ${line#*: }; done } _svn_lls () { local opt=$1 f=; shift; for f in "$@"; do if [[ $opt == @(dir|all) && -d "$f" ]]; then echo "$f/"; else if [[ $opt == @(file|all) ]]; then local dn= fn="$f"; [[ "$f" == */* ]] && dn=${f%\/*}/ fn=${f##*\/}; [ -f "${dn}.svn/text-base/${fn}.svn-base" ] && echo "$f"; fi; fi; done } _svn_read_hashfile () { local tkey=$1 key= val=; while true; do read tag len; [ $tag = 'END' ] && break; [ $tag != 'K' ] && { return }; read -r -n $len key; read; read tag len; [ $tag != 'V' ] && { return }; read -r -n $len val; read; if [[ $key = $tkey ]]; then echo "$val"; return; fi; done } _svnadmin () { local cur cmds cmdOpts optsParam opt helpCmds optBase i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; cmds='build-repcache crashtest create delrevprop deltify dump dump-revprops freeze \ help hotcopy info list-dblogs list-unused-dblogs \ load load-revprops lock lslocks lstxns pack recover rev-size rmlocks \ rmtxns setlog setrevprop setuuid unlock upgrade verify --version'; if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY=($( compgen -W "$cmds" -- $cur )); return 0; fi; optsParam="-r|--revision|--parent-dir|--fs-type|-M|--memory-cache-size"; optsParam="$optsParam|-F|--file|--exclude|--include"; helpCmds='help|--help|h|\?'; if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && [[ "$cur" != -* ]] || [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]]; then return 0; fi; cmdOpts=; case ${COMP_WORDS[1]} in build-repcache) cmdOpts="-r --revision -q --quiet -M --memory-cache-size" ;; create) cmdOpts="--bdb-txn-nosync --bdb-log-keep --config-dir --fs-type --compatible-version" ;; deltify) cmdOpts="-r --revision -q --quiet -M --memory-cache-size" ;; dump) cmdOpts="-r --revision --incremental -q --quiet --deltas -M --memory-cache-size -F --file --exclude --include --pattern" ;; dump-revprops) cmdOpts="-r --revision -q --quiet -F --file" ;; freeze) cmdOpts="-F --file" ;; help | h | \?) cmdOpts="$cmds" ;; hotcopy) cmdOpts="--clean-logs --incremental -q --quiet" ;; load) cmdOpts="--ignore-uuid --force-uuid --parent-dir -q --quiet --use-pre-commit-hook --use-post-commit-hook --bypass-prop-validation -M --memory-cache-size --no-flush-to-disk --normalize-props -F --file --ignore-dates -r --revision" ;; load-revprops) cmdOpts="-r --revision -q --quiet -F --file --bypass-prop-validation --normalize-props --force-uuid --no-flush-to-disk" ;; lstxns) cmdOpts="-r --revision" ;; lock | unlock) cmdOpts="--bypass-hooks -q --quiet" ;; pack) cmdOpts="-M --memory-cache-size -q --quiet" ;; recover) cmdOpts="--wait" ;; rev-size) cmdOpts="-r --revision -M --memory-cache-size -q --quiet" ;; rmlocks) cmdOpts="-q --quiet" ;; rmtxns) cmdOpts="-q --quiet" ;; setlog) cmdOpts="-r --revision --bypass-hooks" ;; setrevprop | delrevprop) cmdOpts="-r --revision -t --transaction --use-pre-revprop-change-hook --use-post-revprop-change-hook" ;; verify) cmdOpts="-r --revision -t --transaction -q --quiet --check-normalization --keep-going -M --memory-cache-size --metadata-only" ;; *) ;; esac; cmdOpts="$cmdOpts --help -h"; for ((i=2; i<=$COMP_CWORD-1; ++i )) do opt=${COMP_WORDS[$i]}; case $opt in --*) optBase=${opt/=*/} ;; -*) optBase=${opt:0:2} ;; esac; cmdOpts=" $cmdOpts "; cmdOpts=${cmdOpts/ ${optBase} / }; case $optBase in -q) cmdOpts=${cmdOpts/ --quiet / } ;; --quiet) cmdOpts=${cmdOpts/ -q / } ;; -h) cmdOpts=${cmdOpts/ --help / } ;; --help) cmdOpts=${cmdOpts/ -h / } ;; -r) cmdOpts=${cmdOpts/ --revision / } ;; --revision) cmdOpts=${cmdOpts/ -r / } ;; -t) cmdOpts=${cmdOpts/ --transaction / } ;; --transaction) cmdOpts=${cmdOpts/ -t / } ;; -F) cmdOpts=${cmdOpts/ --file / } ;; --file) cmdOpts=${cmdOpts/ -F / } ;; -M) cmdOpts=${cmdOpts/ --memory-cache-size / } ;; --memory-cache-size) cmdOpts=${cmdOpts/ --M / } ;; esac; if [[ $opt == @($optsParam) ]]; then ((++i)); fi; done; COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); return 0 } _svndumpfilter () { local cur cmds cmdOpts optsParam opt helpCmds optBase i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; cmds='exclude help include --version'; if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY=($( compgen -W "$cmds" -- $cur )); return 0; fi; optsParam="--targets"; helpCmds='help|--help|h|\?'; if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && [[ "$cur" != -* ]] || [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]]; then return 0; fi; cmdOpts=; case ${COMP_WORDS[1]} in exclude | include) cmdOpts="--drop-empty-revs --drop-all-empty-revs --renumber-revs --skip-missing-merge-sources --targets --preserve-revprops --quiet --pattern" ;; help | h | \?) cmdOpts="$cmds" ;; *) ;; esac; cmdOpts="$cmdOpts --help -h"; for ((i=2; i<=$COMP_CWORD-1; ++i )) do opt=${COMP_WORDS[$i]}; case $opt in --*) optBase=${opt/=*/} ;; -*) optBase=${opt:0:2} ;; esac; cmdOpts=" $cmdOpts "; cmdOpts=${cmdOpts/ ${optBase} / }; case $optBase in -h) cmdOpts=${cmdOpts/ --help / } ;; --help) cmdOpts=${cmdOpts/ -h / } ;; esac; if [[ $opt == @($optsParam) ]]; then ((++i)); fi; done; COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); return 0 } _svnlook () { local cur cmds cmdOpts optsParam opt helpCmds optBase i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; cmds='author cat changed date diff dirs-changed filesize help history \ info lock log propget proplist tree uuid youngest --version'; if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY=($( compgen -W "$cmds" -- $cur )); return 0; fi; optsParam="-r|--revision|-t|--transaction|-l|--limit|-x|--extensions"; helpCmds='help|--help|h|\?'; if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && [[ "$cur" != -* ]] || [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]]; then return 0; fi; cmdOpts=; case ${COMP_WORDS[1]} in author) cmdOpts="-r --revision -t --transaction" ;; cat) cmdOpts="-r --revision -t --transaction" ;; changed) cmdOpts="-r --revision -t --transaction --copy-info" ;; date) cmdOpts="-r --revision -t --transaction" ;; diff) cmdOpts="-r --revision -t --transaction --diff-copy-from --no-diff-added --no-diff-deleted -x --extensions" ;; dirs-changed) cmdOpts="-r --revision -t --transaction" ;; filesize) cmdOpts="-r --revision -t --transaction" ;; help | h | \?) cmdOpts="$cmds" ;; history) cmdOpts="-r --revision -l --limit --show-ids" ;; info) cmdOpts="-r --revision -t --transaction" ;; lock) cmdOpts= ;; log) cmdOpts="-r --revision -t --transaction" ;; propget | pget | pg) cmdOpts="-r --revision -t --transaction --revprop" ;; proplist | plist | pl) cmdOpts="-r --revision -t --transaction --revprop -v --verbose --xml" ;; tree) cmdOpts="-r --revision -t --transaction --full-paths -N --non-recursive --show-ids" ;; uuid) cmdOpts= ;; youngest) cmdOpts= ;; *) ;; esac; cmdOpts="$cmdOpts --help -h"; for ((i=2; i<=$COMP_CWORD-1; ++i )) do opt=${COMP_WORDS[$i]}; case $opt in --*) optBase=${opt/=*/} ;; -*) optBase=${opt:0:2} ;; esac; cmdOpts=" $cmdOpts "; cmdOpts=${cmdOpts/ ${optBase} / }; case $optBase in -N) cmdOpts=${cmdOpts/ --non-recursive / } ;; --non-recursive) cmdOpts=${cmdOpts/ -N / } ;; -h) cmdOpts=${cmdOpts/ --help / } ;; --help) cmdOpts=${cmdOpts/ -h / } ;; -l) cmdOpts=${cmdOpts/ --limit / } ;; --limit) cmdOpts=${cmdOpts/ -l / } ;; -r) cmdOpts=${cmdOpts/ --revision / } ;; --revision) cmdOpts=${cmdOpts/ -r / } ;; -t) cmdOpts=${cmdOpts/ --transaction / } ;; --transaction) cmdOpts=${cmdOpts/ -t / } ;; -v) cmdOpts=${cmdOpts/ --verbose / } ;; --verbose) cmdOpts=${cmdOpts/ -v / } ;; -x) cmdOpts=${cmdOpts/ --extensions / } ;; --extensions) cmdOpts=${cmdOpts/ -x / } ;; esac; if [[ $opt == @($optsParam) ]]; then ((++i)); fi; done; COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); return 0 } _svnsync () { local cur cmds cmdOpts optsParam opt helpCmds optBase i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; cmds='copy-revprops help info initialize synchronize --version'; if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY=($( compgen -W "$cmds" -- $cur )); return 0; fi; optsParam="--config-dir|--config-option|--source-username|--source-password"; optsParam="$optsParam|--sync-username|--sync-password"; helpCmds='help|--help|h|\?'; if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && [[ "$cur" != -* ]] || [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]]; then return 0; fi; cmdOpts=; case ${COMP_WORDS[1]} in copy-revprops | initialize | init | synchronize | sync) cmdOpts="--non-interactive --no-auth-cache --trust-server-cert --source-username --source-password --sync-username --sync-password --config-dir --config-option -q --quiet -M --memory-cache-size" ;; help | h | \?) cmdOpts="$cmds" ;; info) cmdOpts="--non-interactive --no-auth-cache --trust-server-cert --source-username --source-password --sync-username --sync-password --config-dir --config-option" ;; *) ;; esac; cmdOpts="$cmdOpts --help -h"; for ((i=2; i<=$COMP_CWORD-1; ++i )) do opt=${COMP_WORDS[$i]}; case $opt in --*) optBase=${opt/=*/} ;; -*) optBase=${opt:0:2} ;; esac; cmdOpts=" $cmdOpts "; cmdOpts=${cmdOpts/ ${optBase} / }; case $optBase in -h) cmdOpts=${cmdOpts/ --help / } ;; --help) cmdOpts=${cmdOpts/ -h / } ;; -q) cmdOpts=${cmdOpts/ --quiet / } ;; --quiet) cmdOpts=${cmdOpts/ -q / } ;; esac; if [[ $opt == @($optsParam) ]]; then ((++i)); fi; done; COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); return 0 } _svnversion () { local cmdOpts=" -n --no-newline -c --committed -h --help --version "; local cur=${COMP_WORDS[COMP_CWORD]}; COMPREPLY=(); local options= wcpath= trailurl= last='none' stat= opt= i=-1 isCur=; for opt in ${COMP_WORDS[@]}; do [[ $i -eq $COMP_CWORD ]] && stat=$last; let i++; isCur=; [[ $i -eq $COMP_CWORD ]] && isCur=1; if [ $last = 'none' ]; then last='first'; continue; fi; if [[ $last != 'arg' && $opt == -* ]]; then if [[ $opt = '--' && ! -n $isCur ]]; then last='arg'; else options="$options $opt "; last='opt'; fi; continue; fi; if [[ $opt != -* ]]; then last='arg'; if [[ ! -n $wcpath ]]; then wcpath=$opt; else if [[ ! -n $trailurl ]]; then trailurl=$opt; fi; fi; fi; done; [[ -n $stat ]] || stat=$last; if [[ $cur != -* || $stat = 'arg' ]]; then [[ -n $wcpath && -n $trailurl ]] && COMPREPLY=(''); return 0; fi; for opt in $options; do cmdOpts=${cmdOpts/ $opt / }; case $opt in -n) cmdOpts=${cmdOpts/ --no-newline / } ;; --no-newline) cmdOpts=${cmdOpts/ -n / } ;; -h) cmdOpts=${cmdOpts/ --help / } ;; --help) cmdOpts=${cmdOpts/ -h / } ;; -c) cmdOpts=${cmdOpts/ --committed / } ;; --committed) cmdOpts=${cmdOpts/ -c / } ;; esac; done; COMPREPLY=($( compgen -W "$cmdOpts" -- $cur )); return 0 } _sysvdirs () { sysvdirs=(); [[ -d /etc/rc.d/init.d ]] && sysvdirs+=(/etc/rc.d/init.d); [[ -d /etc/init.d ]] && sysvdirs+=(/etc/init.d); [[ -f /etc/slackware-version ]] && sysvdirs=(/etc/rc.d); return 0 } _terms () { COMPREPLY+=($(compgen -W "$({ command sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap { toe -a || toe } | awk '{ print $1 }' find /{etc,lib,usr/lib,usr/share}/terminfo/? -type f -maxdepth 1 | awk -F/ '{ print $NF }' } 2>/dev/null)" -- "$cur")) } _tilde () { local result=0; if [[ ${1-} == \~* && $1 != */* ]]; then COMPREPLY=($(compgen -P '~' -u -- "${1#\~}")); result=${#COMPREPLY[@]}; ((result > 0)) && compopt -o filenames 2> /dev/null; fi; return $result } _uids () { if type getent &> /dev/null; then COMPREPLY=($(compgen -W '$(getent passwd | cut -d: -f3)' -- "$cur")); else if type perl &> /dev/null; then COMPREPLY=($(compgen -W '$(perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"')' -- "$cur")); else COMPREPLY=($(compgen -W '$(cut -d: -f3 /etc/passwd)' -- "$cur")); fi; fi } _upvar () { echo "bash_completion: $FUNCNAME: deprecated function," "use _upvars instead" 1>&2; if unset -v "$1"; then if (($# == 2)); then eval $1=\"\$2\"; else eval $1=\(\"\$"{@:2}"\"\); fi; fi } _upvars () { if ! (($#)); then echo "bash_completion: $FUNCNAME: usage: $FUNCNAME" "[-v varname value] | [-aN varname [value ...]] ..." 1>&2; return 2; fi; while (($#)); do case $1 in -a*) [[ -n ${1#-a} ]] || { echo "bash_completion: $FUNCNAME:" "\`$1': missing number specifier" 1>&2; return 1 }; printf %d "${1#-a}" &> /dev/null || { echo bash_completion: "$FUNCNAME: \`$1': invalid number specifier" 1>&2; return 1 }; [[ -n "$2" ]] && unset -v "$2" && eval $2=\(\"\$"{@:3:${1#-a}}"\"\) && shift $((${1#-a} + 2)) || { echo bash_completion: "$FUNCNAME: \`$1${2+ }$2': missing argument(s)" 1>&2; return 1 } ;; -v) [[ -n "$2" ]] && unset -v "$2" && eval $2=\"\$3\" && shift 3 || { echo "bash_completion: $FUNCNAME: $1:" "missing argument(s)" 1>&2; return 1 } ;; *) echo "bash_completion: $FUNCNAME: $1: invalid option" 1>&2; return 1 ;; esac; done } _urpme () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$common_options -a --auto --test --auto-orphans --parallel --justdb --noscripts" -- $cur )); else _xfunc rpm _rpm_installed_packages; fi } _urpmf () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in --media) _urpmi_medias; return 0 ;; --excludemedia) _urpmi_medias; return 0 ;; --sortmedia) _urpmi_medias; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$common_options -i -f -e -a -o -m --update --media --excludemedia --literal --sortmedia --synthesis --use-distrib --uniq --name --group --license --size --epoch --summary --description --sourcerpm --packager--buildhost --url --provides --recommends --requires --files --conflicts --obsoletes --env" -- $cur )); else _filedir; fi } _urpmi () { local cur prev options; COMPREPLY=(); cur=`_get_cword`; prev=`_get_pword`; case "$prev" in --media) _urpmi_medias; return 0 ;; --excludemedia) _urpmi_medias; return 0 ;; --sortmedia) _urpmi_medias; return 0 ;; --searchmedia) _urpmi_medias; return 0 ;; --parallel) _urpmi_aliases; return 0 ;; --root | --urpmi-root) _filedir -d; return 0 ;; esac; if [[ "$cur" == -* ]]; then options="$common_options -a -p -P -y --update --media --excludemedia --sortmedia --synthesis --auto --auto-select --no-uninstall --split-level --split-length --fuzzy --buildrequires --install-src --clean --noclean --parallel --wget --prozilla --curl --limit-rate --proxy --proxy-user --bug --no-verify-rpm --no-install --test --excludepath --excludedocs --searchmedia --ignoresize --ignorearch --strict-arch --wget-options --curl-options --prozilla-options --rsync-options --resume --retry --skip --prefer --nolock --more-choices --downgrade --deploops --debug-librpm"; if [[ ${COMP_WORDS[0]} != *rurpmi ]]; then options="$options --root --use-distrib --env --auto-orphans --replacepkgs --justdb --allow-nodeps --allow-force --no-recommends --force --noscripts --auto-update --keep --nokeep --replacefiles --verify-rpm"; for ((i=1; i < COMP_CWORD; i++ )) do case ${COMP_WORDS[i]} in ----auto-update) options="$options --no-md5sum --force-key" ;; esac; done; fi; COMPREPLY=($( compgen -W "$options" -- $cur )); else if [[ ${COMP_WORDS[0]} == *rurpmi ]]; then _urpmi_packages; else if [[ "$cur" != */* ]]; then _urpmi_packages; fi; _filedir '@(rpm|spec)'; fi; fi } _urpmi_addmedia () { local cur i args; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$common_options -f --wget --curl --prozilla --limit-rate --proxy --proxy-user --update --raw --probe-synthesis --probe-hdlist --probe-rpms --no-probe --distrib --env --version --arch --virtual --norebuild --nopubkey" -- $cur )); else args=$COMP_CWORD; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -* ]]; then args=$(($args-1)); fi; done; case $args in 1) _urpmi_medias ;; 2) COMPREPLY=($( compgen -W 'file:// http:// \ ftp:// removable:// ssh:// \ rsync://' -- $cur )) ;; 3) COMPREPLY=('with') ;; esac; fi } _urpmi_aliases () { COMPREPLY=($( awk -F: '{print $1}' /etc/urpmi/parallel.cfg 2>/dev/null | \grep "^${cur//\\\\/}" )) } _urpmi_get_medias () { medias=($( urpmq --list-media $1 2>/dev/null | \sed -e 's/(/\\(/g' -e 's/)/\\)/g' -e 's/ /\\ /g' )) } _urpmi_medias () { local medias IFS=' '; _urpmi_get_medias all; COMPREPLY=($( compgen -W '${medias[@]}' -- $cur )) } _urpmi_packages () { local options; for ((i=1; i < COMP_CWORD; i++ )) do case "${COMP_WORDS[i]}" in --@\(excludemedia | media\)) options="$options ${COMP_WORDS[i]} ${COMP_WORDS[i+1]}"; i=$(($i+1)) ;; --update) options="$options ${COMP_WORDS[i]}" ;; esac; done; COMPREPLY=($( compgen -W "$(urpmq $options --list | \grep ^$cur )" -- )) } _urpmi_removemedia () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$common_options -a -y" -- $cur )); else _urpmi_medias; fi } _urpmi_update () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$common_options -a -f --wget --prozilla --curl --limit-rate --proxy --proxy-user --update --ignore --no-ignore --no-md5sum --force-key --norebuild" -- $cur)); else _urpmi_medias; fi } _urpmq () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in --media) _urpmi_medias; return 0 ;; --excludemedia) _urpmi_medias; return 0 ;; --sortmedia) _urpmi_medias; return 0 ;; --parallel) _urpmi_nodes; return 0 ;; --list-media) COMPREPLY=($( compgen -W 'all update active' -- $cur)); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$common_options -d -u -m -a -c -y -s -i -g -p -r -f -l --update --media --excludemedia --sortmedia --synthesis --auto-select --auto-orphans --not-available --no-recommends --fuzzy --keep --nokeep --list --list-url --list-media --list-nodes --list-aliases --src --sources --provides --requires --obsoletes --recommends --summary --sourcerpm --force --parallel --wget --curl --prozilla --changelog --conflicts --proxy --proxy-user --env --dump-config --whatprovides --whatrequires --whatrequires-recursive --skip --prefer --use-distrib --searchmedia --ignorearch" -- $cur)); else _filedir rpm; fi } _usb_ids () { COMPREPLY+=($(compgen -W "$(PATH="$PATH:/sbin" lsusb | awk '{print $6}')" -- "$cur")) } _user_at_host () { local cur prev words cword; _init_completion -n : || return; if [[ $cur == *@* ]]; then _known_hosts_real "$cur"; else COMPREPLY=($(compgen -u -S @ -- "$cur")); compopt -o nospace; fi } _usergroup () { if [[ $cur == *\\\\* || $cur == *:*:* ]]; then return; else if [[ $cur == *\\:* ]]; then local prefix; prefix=${cur%%*([^:])}; prefix=${prefix//\\/}; local mycur="${cur#*[:]}"; if [[ ${1-} == -u ]]; then _allowed_groups "$mycur"; else local IFS=' '; COMPREPLY=($(compgen -g -- "$mycur")); fi; COMPREPLY=($(compgen -P "$prefix" -W "${COMPREPLY[@]}")); else if [[ $cur == *:* ]]; then local mycur="${cur#*:}"; if [[ ${1-} == -u ]]; then _allowed_groups "$mycur"; else local IFS=' '; COMPREPLY=($(compgen -g -- "$mycur")); fi; else if [[ ${1-} == -u ]]; then _allowed_users "$cur"; else local IFS=' '; COMPREPLY=($(compgen -u -- "$cur")); fi; fi; fi; fi } _userland () { local userland=$(uname -s); [[ $userland == @(Linux|GNU/*) ]] && userland=GNU; [[ $userland == "$1" ]] } _variables () { if [[ $cur =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]; then if [[ $cur == '${'* ]]; then local arrs vars; vars=($(compgen -A variable -P ${BASH_REMATCH[1]} -S '}' -- ${BASH_REMATCH[3]})); arrs=($(compgen -A arrayvar -P ${BASH_REMATCH[1]} -S '[' -- ${BASH_REMATCH[3]})); if ((${#vars[@]} == 1 && ${#arrs[@]} != 0)); then compopt -o nospace; COMPREPLY+=(${arrs[*]}); else COMPREPLY+=(${vars[*]}); fi; else COMPREPLY+=($(compgen -A variable -P '$' -- "${BASH_REMATCH[3]}")); fi; return 0; else if [[ $cur =~ ^(\$\{[#!]?)([A-Za-z0-9_]*)\[([^]]*)$ ]]; then local IFS=' '; COMPREPLY+=($(compgen -W '$(printf %s\\n "${!'${BASH_REMATCH[2]}'[@]}")' -P "${BASH_REMATCH[1]}${BASH_REMATCH[2]}[" -S ']}' -- "${BASH_REMATCH[3]}")); if [[ ${BASH_REMATCH[3]} == [@*] ]]; then COMPREPLY+=("${BASH_REMATCH[1]}${BASH_REMATCH[2]}[${BASH_REMATCH[3]}]}"); fi; __ltrim_colon_completions "$cur"; return 0; else if [[ $cur =~ ^\$\{[#!]?[A-Za-z0-9_]*\[.*\]$ ]]; then COMPREPLY+=("$cur}"); __ltrim_colon_completions "$cur"; return 0; else case ${prev-} in TZ) cur=/usr/share/zoneinfo/$cur; _filedir; for i in "${!COMPREPLY[@]}"; do if [[ ${COMPREPLY[i]} == *.tab ]]; then unset 'COMPREPLY[i]'; continue; else if [[ -d ${COMPREPLY[i]} ]]; then COMPREPLY[i]+=/; compopt -o nospace; fi; fi; COMPREPLY[i]=${COMPREPLY[i]#/usr/share/zoneinfo/}; done; return 0 ;; TERM) _terms; return 0 ;; LANG | LC_*) COMPREPLY=($(compgen -W '$(locale -a 2>/dev/null)' -- "$cur")); return 0 ;; esac; fi; fi; fi; return 1 } _xfunc () { set -- "$@"; local srcfile=$1; shift; declare -F $1 &> /dev/null || __load_completion "$srcfile"; "$@" } _xinetd_services () { local xinetddir=${BASHCOMP_XINETDDIR:-/etc/xinetd.d}; if [[ -d $xinetddir ]]; then local IFS=' ' reset=$(shopt -p nullglob); shopt -s nullglob; local -a svcs=($(printf '%s\n' $xinetddir/!($_backup_glob))); $reset; ((!${#svcs[@]})) || COMPREPLY+=($(compgen -W '${svcs[@]#$xinetddir/}' -- "${cur-}")); fi } dequote () { eval printf %s "$1" 2> /dev/null } gawklibpath_append () { [ -z "$AWKLIBPATH" ] && AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'`; export AWKLIBPATH="$AWKLIBPATH:$*" } gawklibpath_default () { unset AWKLIBPATH; export AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'` } gawklibpath_prepend () { [ -z "$AWKLIBPATH" ] && AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'`; export AWKLIBPATH="$*:$AWKLIBPATH" } gawkpath_append () { [ -z "$AWKPATH" ] && AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'`; export AWKPATH="$AWKPATH:$*" } gawkpath_default () { unset AWKPATH; export AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'` } gawkpath_prepend () { [ -z "$AWKPATH" ] && AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'`; export AWKPATH="$*:$AWKPATH" } quote () { local quoted=${1//\'/\'\\\'\'}; printf "'%s'" "$quoted" } quote_readline () { local ret; _quote_readline_by_ref "$1" ret; printf %s "$ret" }
View Attachment As Raw
Actions:
View
Attachments on
bug 28022
:
12184
| 12185