diff options
Diffstat (limited to 'Completion/Unix/Command')
25 files changed, 1893 insertions, 310 deletions
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 663c7c495..fe810e1c4 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -16,6 +16,7 @@ _baz _bison _bittorrent _bogofilter +_bpython _bzip2 _bzr _cal @@ -137,6 +138,7 @@ _mh _mkdir _module _monotone +_moosic _mosh _mount _mpc @@ -155,6 +157,7 @@ _nmap _notmuch _npm _nslookup +_od _pack _patch _pax diff --git a/Completion/Unix/Command/_bpython b/Completion/Unix/Command/_bpython new file mode 100644 index 000000000..c51cc8c3c --- /dev/null +++ b/Completion/Unix/Command/_bpython @@ -0,0 +1,46 @@ +#compdef bpython bpython-gtk bpython-urwid bpython2 bpython2-gtk bpython2-urwid bpython3 bpython3-gtk bpython3-urwid + +local -a all_opts urwid_opts gtk_opts + +all_opts=( + '--config[configuration file]:config file:_files' + '-h --help[show help message]' + '(-i --interactive)'{-i,--interactive}'[drop to bpython after running a file]' + '(-q --quiet)'{-q,--quiet}'[do not flush the output to stdout]' + '(-V --version)'{-V,--version}'[print version]' + '1:script:_files -g "*.u#py(-.)"' + '*:arguments:' +) + +urwid_opts=( + '(-r --reactor)'{-r,--reactor}'[use Twisted reactor instead of the event loop]:reactor:' + '--help-reactors[display list of available Twisted reactors]' + '(-p --plugin)'{-p,--plugin}'[exectue a twistd plugin]:plugin:' + '(-s --server)'{-s,--server}'[run an eval server on the given port]:port:' +) + +gtk_opts=( + '--socket-id[embed bpython]:socket id:' +) + +case "$service" in + bpython|bpython2|bpython3) + _arguments \ + "$all_opts[@]" && return 0 + ;; + + bpython-urwid|bpython2-urwid|bpython3-urwid) + _arguments \ + "$all_opts[@]" \ + "$urwid_opts[@]" && return 0 + ;; + + bpython-gtk|bpython2-gtk|bpython3-gtk) + _arguments \ + "$all_opts[@]" \ + "$gtk_opts[@]" && return 0 + ;; +esac + + +# vim:autoindent expandtab shiftwidth=2 tabstop=2 softtabstop=2 filetype=zsh diff --git a/Completion/Unix/Command/_bzr b/Completion/Unix/Command/_bzr index 23feb6f83..c28c2148e 100644 --- a/Completion/Unix/Command/_bzr +++ b/Completion/Unix/Command/_bzr @@ -25,7 +25,7 @@ curcontext="${curcontext%:*:*}:bzr-$cmd:" (( $+functions[_bzr_unknownFiles] )) || _bzr_unknownFiles() { local fileList - fileList=(${(ps:\0:)"$(bzr ls --null --unknown)"}) + fileList=(${(ps:\0:)"$(bzr ls --null --unknown -R)"}) compadd -af fileList return 0 } @@ -41,7 +41,15 @@ _bzr_unknownRoot() { (( $+functions[_bzr_versionedFiles] )) || _bzr_versionedFiles() { local fileList - fileList=(${(ps:\0:)"$(bzr ls --null --versioned)"}) + fileList=(${(ps:\0:)"$(bzr ls --null --versioned -R)"}) + compadd -af fileList + return 0 +} + +(( $+functions[_bzr_modifiedFiles] )) || +_bzr_modifiedFiles() { + local fileList + fileList=(${(ps:\0:)"$(bzr status . --versioned --short | cut -b 5- | tr '\n' '\0')"}) compadd -af fileList return 0 } @@ -214,7 +222,7 @@ case $cmd in '--unchanged[include unchanged files]' '(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]' '(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]' - '*:modified files:_bzr_versionedFiles' + '*:modified files:_bzr_modifiedFiles' ) ;; @@ -300,7 +308,7 @@ case $cmd in args+=( '--no-backup[skip generation of backup~ files]' '(-r --revision)'{--revision=,-r}'[revision]:revision:' - '*:file:_bzr_versionedFiles' + '*:file:_bzr_modifiedFiles' ) ;; diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index b14c13334..c6bbabbe9 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -1,6 +1,6 @@ #compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CPPFLAGS,-default- -local curcontext="$curcontext" state line ret=1 expl args args2 +local curcontext="$curcontext" state line ret=1 expl args args2 march typeset -A opt_args if [[ "$service" = -value-* ]]; then @@ -76,7 +76,7 @@ rs6000|powerpc*) -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt -mno-powerpc-gfxopt -mnew-mnemonics -mno-new-mnemonics - -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc + -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc -msoft-float -mhard-float -mmultiple -mno-multiple -mstring -mno-string -mbit-align -mno-bit-align -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable @@ -110,34 +110,118 @@ mips*) ) ;; i[3456]86|x86_64) + march="native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 c3-2 geode" args=( - '-mtune=:CPU type:(i386 i486 i586 pentium pentium-mmx i686 pentiumpro pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx winchip-c6 winchip2 c3 c3-2)' - '-march=:CPU type:(i386 i486 i586 pentium pentium-mmx i686 pentiumpro pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx winchip-c6 winchip2 c3 c3-2)' - '-mfpmath=:FPU type:(387 sse sse,387)' - '-masm=:asm dialect:(att intel)' - -mieee-fp -mno-ieee-fp -msoft-float - -mno-fp-ret-in-387 -mno-fancy-math-387 - -malign-double -mno-align-double - -m128bit-long-double -m96bit-long-double - -msvr3-shlib -mno-svr3-shlib - -mrtd - '-mregparm=:number of integer argument registers:' - '-mpreferred-stack-boundary=:size of boundary:' - -mmmx -msse -msse2 -msse3 -m3dnow - -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow - -mpush-args -mno-push-args -maccumulate-outgoing-args + '-mtune=-[tune code for CPU type]:CPU type:('"$march"')' + '-march=-[generate instructions for CPU type]:CPU type:('"generic $march"')' -mthreads - -mno-align-stringops -minline-all-stringops - -momit-leaf-frame-pointer - -mtls-direct-seg-refs -mno-tls-direct-seg-refs - -m32 -m64 - -mno-red-zone - '-mcmodel=:memory model:(small kernel medium large)' - -mno-wide-multiply '-mreg-alloc=:default register allocation order:' - '-malign-jumps=: **2 base for jump goal alignment:' - '-malign-loops=: **2 base for loop alignment:' - '-malign-functions=: **2 base for function alignment:' + + # arguments with options + '-mabi=-[Generate code that conforms to the given ABI]:abi:(ms sysv)' + '-maddress-mode=-[Use given address mode]:address mode:(short long)' + '-malign-functions=-[Function starts are aligned to this power of 2]: **2 base for function alignment: ' + '-malign-jumps=-[Jump targets are aligned to this power of 2]: **2 base for jump goal alignment: ' + '-malign-loops=-[Loop code aligned to this power of 2]: **2 base for loop alignment: ' + '-masm=-[Use given assembler dialect]:asm dialect:(att intel)' + '-mbranch-cost=-[Branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): ' + '-mcmodel=-[Use given x86-64 code model]:memory model:(32 small kernel medium large)' + '-mfpmath=-[Generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)' + '-mincoming-stack-boundary=-[Assume incoming stack aligned to this power of 2]:assumed size of boundary: ' + '-mlarge-data-threshold=-[Data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: ' + '-mpreferred-stack-boundary=-[Attempt to keep stack aligned to this power of 2]:size of boundary: ' + '-mregparm=-[Number of registers used to pass integer arguments]:number of integer argument registers: ' + '-mstringop-strategy=-[Chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)' + '-mtls-dialect=-[Use given thread-local storage dialect]:TLS dialect:(gnu gnu2)' + '-mveclibabi=-[Vector library ABI to use]:vector library ABI:(acml svml)' + + # arguments without options + '-m3dnow[Support 3DNow! built-in functions]' + '-m8bit-idiv[Expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]' + '-m32[Generate 32bit i386 code]' + '-m64[Generate 64bit x86-64 code]' + '-m96bit-long-double[sizeof(long double) is 12]' + '-m128bit-long-double[sizeof(long double) is 16]' + '-m80387[Use hardware fp]' + '-mabm[Support code generation of Advanced Bit Manipulation (ABM) instructions]' + '-maccumulate-outgoing-args[Reserve space for outgoing arguments in the function prologue]' + '-madx[Support flag-preserving add-carry instructions]' + '-maes[Support AES built-in functions and code generation]' + '-malign-double[Align some doubles on dword boundary]' + '-malign-stringops[Align destination of the string operations]' + '-mandroid[Generate code for the Android platform]' + '-mavx2[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]' + '-mavx256-split-unaligned-load[Split 32-byte AVX unaligned load]' + '-mavx256-split-unaligned-store[Split 32-byte AVX unaligned store]' + '-mavx[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]' + '-mbionic[Use Bionic C library]' + '-mbmi2[Support BMI2 built-in functions and code generation]' + '-mbmi[Support BMI built-in functions and code generation]' + '-mcld[Generate cld instruction in the function prologue]' + '-mcrc32[Support code generation of crc32 instruction]' + '-mcx16[Support code generation of cmpxchg16b instruction]' + '-mdispatch-scheduler[Do dispatch scheduling if processor is bdver1 or bdver2 or bdver3 and Haifa scheduling is selected]' + '-mf16c[Support F16C built-in functions and code generation]' + '-mfancy-math-387[Generate sin, cos, sqrt for FPU]' + '-mfentry[Emit profiling counter call at function entry before prologue]' + '-mfma4[Support FMA4 built-in functions and code generation ]' + '-mfma[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]' + '-mforce-drap[Always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]' + '-mfp-ret-in-387[Return values of functions in FPU registers]' + '-mfsgsbase[Support FSGSBASE built-in functions and code generation]' + '-mfxsr[Support FXSAVE and FXRSTOR instructions]' + '-mglibc[Use GNU C library]' + '-mhard-float[Use hardware fp]' + '-mhle[Support Hardware Lock Elision prefixes]' + '-mieee-fp[Use IEEE math for fp comparisons]' + '-minline-all-stringops[Inline all known string operations]' + '-minline-stringops-dynamically[Inline memset/memcpy string operations, but perform inline version only for small blocks]' + '-mlong-double-64[Use 64-bit long double]' + '-mlong-double-80[Use 80-bit long double]' + '-mlwp[Support LWP built-in functions and code generation ]' + '-mlzcnt[Support LZCNT built-in function and code generation]' + '-mmmx[Support MMX built-in functions]' + '-mmovbe[Support code generation of movbe instruction]' + '-mms-bitfields[Use native (MS) bitfield layout]' + '-mno-sse4[Do not support SSE4.1 and SSE4.2 built-in functions and code generation]' + '-momit-leaf-frame-pointer[Omit the frame pointer in leaf functions]' + '-mpc32[Set 80387 floating-point precision to 32-bit]' + '-mpc64[Set 80387 floating-point precision to 64-bit]' + '-mpc80[Set 80387 floating-point precision to 80-bit]' + '-mpclmul[Support PCLMUL built-in functions and code generation]' + '-mpopcnt[Support code generation of popcnt instruction]' + '-mprefer-avx128[Use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]' + '-mprfchw[Support PREFETCHW instruction]' + '-mpush-args[Use push instructions to save outgoing arguments]' + '-mrdrnd[Support RDRND built-in functions and code generation]' + '-mrdseed[Support RDSEED instruction]' + '-mrecip[Generate reciprocals instead of divss and sqrtss]' + '-mred-zone[Use red-zone in the x86-64 code]' + '-mrtd[Alternate calling convention]' + '-mrtm[Support RTM built-in functions and code generation]' + '-msahf[Support code generation of sahf instruction in 64bit x86-64 code]' + '-msoft-float[Do not use hardware fp]' + '-msse2[Support MMX, SSE and SSE2 built-in functions and code generation]' + '-msse2avx[Encode SSE instructions with VEX prefix]' + '-msse3[Support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]' + '-msse4.1[Support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]' + '-msse4.2[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' + '-msse4[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' + '-msse4a[Support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]' + '-msse[Support MMX and SSE built-in functions and code generation]' + '-msseregparm[Use SSE register passing conventions for SF and DF mode]' + '-mssse3[Support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]' + '-mstack-arg-probe[Enable stack probing]' + '-mstackrealign[Realign stack in prologue]' + '-mtbm[Support TBM built-in functions and code generation]' + '-mtls-direct-seg-refs[Use direct references against %gs when accessing tls data]' + '-muclibc[Use uClibc C library]' + '-mvect8-ret-in-mem[Return 8-byte vectors in memory]' + '-mvzeroupper[Generate vzeroupper instruction before a transfer of control flow out of the function]' + '-mx32[Generate 32bit x86-64 code]' + '-mxop[Support XOP built-in functions and code generation ]' + '-mxsave[Support XSAVE and XRSTOR instructions]' + '-mxsaveopt[Support XSAVEOPT instruction]' ) ;; hppa*) @@ -222,90 +306,635 @@ if [[ "$service" = clang* ]]; then ) fi +local -a languages +languages=( + c c-header cpp-output + c++ c++-header c++-cpp-output + objective-c objective-c-header objective-c-cpp-output + objective-c++ objective-c++-header objective-c++-cpp-output + assembler assembler-with-cpp + ada + f77 f77-cpp-input f95 f95-cpp-input + go + java +) + +# generic options (from --help) +args+=( + -a -C -H -P -s + '-###[print commands to run this compilation]' + '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"' + '-x[Specify the language of the following input files]:input file language:('"$languages"')' + '+e-:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))' + '-d-:dump:->dump' + '-g-::debugging information type or level:(0 1 2 3 gdb coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 xcoff xcoff+)' + '-O-::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))' + '*-M-::output dependencies:((M\:only\ user\ header\ files MD\:output\ to\ file G\:treat\ missing\ header\ files\ as\ generated))' + '*-A-:define assertion:' + '*-D-:define macro:' + '*-U-:undefine macro:' + '-E[Preprocess only; do not compile, assemble or link]' + '-S[Compile only; do not assemble or link]' + '-c[Compile and assemble, but do not link]' + '*-Wp,-:preprocessor option:' + '*-Wl,-:linker option:' + '*-Xpreprocessor:preprocessor option:' + '*-Xlinker:linker option:' + '*-Xassembler:assembler option:' + '*-u:pretend symbol to be undefined:' + '*-Wa,-:assembler option:' + '*-l:library:->library' + '*-L-:library search path:_files -/' + '*-I-:header file search path:_files -/' + '-B-[Add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/' + '-b:target machine:' + '-V:specify compiler version:' + '--version[Display compiler version information]' + '-print-file-name=-[Display the full path to library <library>]:library:->library' + '-print-prog-name=-[Display the full path to compiler component <program>]:program:' + '*-specs=-[Override built-in specs with the contents of <file>]:file:_files' + '-std=-[Assume that the input sources are for <standard>]:standard:(c90 c89 c99 c11 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y)' + '*-include:include file:_files -g \*.h\(-.\)' + '*-imacros:macro input file:_files -g \*.h\(-.\)' + '*-idirafter:second include path directory:_files -/' + '*-iprefix:prefix:_files' + '*-iwithprefix:second include path directory:_files -/' + '*-iwithprefixbefore:main include path directory:_files -/' + '*-isystem:second include path directory (system):_files -/' + '--sysroot=-[Use <directory> as the root directory for headers and libraries]:directory:_files -/' + '-pass-exit-codes[Exit with highest error code from a phase]' + '*--help=-[Display this information]:class:->help' + '--target-help[Display target specific command line options]' + '-dumpspecs[Display all of the built in spec strings]' + '-dumpversion[Display the version of the compiler]' + '-dumpmachine[Display the compiler'\''s target processor]' + '-print-search-dirs[Display the directories in the compiler'\''s search path]' + '-print-libgcc-file-name[Display the name of the compiler'\''s companion library]' + '-print-multiarch[Display the target'\''s normalized GNU triplet, used as a component in the library path]' + '-print-multi-directory[Display the root directory for versions of libgcc]' + '-print-multi-lib[Display the mapping between command line options and multiple library search directories]' + '-print-multi-os-directory[Display the relative path to OS libraries]' + '-print-sysroot[Display the target libraries directory]' + '-print-sysroot-headers-suffix[Display the sysroot suffix used to find headers]' + '-save-temps[Do not delete intermediate files]' + '-no-canonical-prefixes[Do not canonicalize paths when building relative prefixes to other gcc components]' + '-pipe[Use pipes rather than intermediate files]' + '-pie[Create a position independent executable]' + '-shared[Create a shared library]' + '-time[Time the execution of each subprocess]' +) + +# warnings (from --help=warnings), note some -W options are listed by --help=common instead +args+=( +# --help=warnings,^joined + '-W[This switch is deprecated; use -Wextra instead]' + '-Wabi-tag[Warn if a subobject has an abi_tag attribute that the complete object type does not have]' + '-Wabi[Warn about things that will change when compiling with an ABI-compliant compiler]' + '-Waddress[Warn about suspicious uses of memory addresses]' + '-Waggregate-return[Warn about returning structures, unions or arrays]' + '-Waggressive-loop-optimizations[Warn if a loop with constant number of iterations triggers undefined behavior]' + '-Waliasing[Warn about possible aliasing of dummy arguments]' + '-Walign-commons[Warn about alignment of COMMON blocks]' + '-Wall[Enable most warning messages]' + '-Wampersand[Warn about missing ampersand in continued character constants]' + '-Warray-bounds[Warn if an array is accessed out of bounds]' + '-Warray-temporaries[Warn about creation of array temporaries]' + '-Wassign-intercept[Warn whenever an Objective-C assignment is being intercepted by the garbage collector]' + '-Wattributes[Warn about inappropriate attribute usage]' + '-Wbad-function-cast[Warn about casting functions to incompatible types]' + '-Wbuiltin-macro-redefined[Warn when a built-in preprocessor macro is undefined or redefined]' + '-Wc++-compat[Warn about C constructs that are not in the common subset of C and C++]' + '-Wc++0x-compat[Deprecated in favor of -Wc++11-compat]' + '-Wc++11-compat[Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]' + '-Wc-binding-type[Warn if the type of a variable might be not interoperable with C]' + '-Wcast-align[Warn about pointer casts which increase alignment]' + '-Wcast-qual[Warn about casts which discard qualifiers]' + '-Wchar-subscripts[Warn about subscripts whose type is "char"]' + '-Wcharacter-truncation[Warn about truncated character expressions]' + '-Wclobbered[Warn about variables that might be changed by "longjmp" or "vfork"]' + '-Wcomment[Warn about possibly nested block comments, and C++ comments spanning more than one physical line]' + '-Wcomments[Synonym for -Wcomment]' + '-Wcompare-reals[Warn about equality comparisons involving REAL or COMPLEX expressions]' + '-Wconversion-extra[Warn about most implicit conversions]' + '-Wconversion-null[Warn for converting NULL from/to a non-pointer type]' + '-Wconversion[Warn for implicit type conversions that may change a value]' + '-Wcoverage-mismatch[Warn in case profiles in -fprofile-use do not match]' + '-Wcpp[Warn when a #warning directive is encountered]' + '-Wctor-dtor-privacy[Warn when all constructors and destructors are private]' + '-Wdeclaration-after-statement[Warn when a declaration is found after a statement]' + '-Wdelete-non-virtual-dtor[Warn about deleting polymorphic objects with non- virtual destructors]' + '-Wdeprecated-declarations[Warn about uses of __attribute__((deprecated)) declarations]' + '-Wdeprecated[Warn if a deprecated compiler feature, class, method, or field is used]' + '-Wdisabled-optimization[Warn when an optimization pass is disabled]' + '-Wdiv-by-zero[Warn about compile-time integer division by zero]' + '-Wdouble-promotion[Warn about implicit conversions from "float" to "double"]' + '-Weffc++[Warn about violations of Effective C++ style rules]' + '-Wempty-body[Warn about an empty body in an if or else statement]' + '-Wendif-labels[Warn about stray tokens after #elif and #endif]' + '-Wenum-compare[Warn about comparison of different enum types]' +#this still exists but makes completing -Werror= less convenient + #'-Werror-implicit-function-declaration[This switch is deprecated; use -Werror=implicit-function-declaration instead]' + '-Wextra[Print extra (possibly unwanted) warnings]' + '-Wfloat-equal[Warn if testing floating point numbers for equality]' + '-Wformat-contains-nul[Warn about format strings that contain NUL bytes]' + '-Wformat-extra-args[Warn if passing too many arguments to a function for its format string]' + '-Wformat-nonliteral[Warn about format strings that are not literals]' + '-Wformat-security[Warn about possible security problems with format functions]' + '-Wformat-y2k[Warn about strftime formats yielding 2-digit years]' + '-Wformat-zero-length[Warn about zero-length formats]' + '-Wformat[Warn about printf/scanf/strftime/strfmon format string anomalies]' + '-Wfree-nonheap-object[Warn when attempting to free a non-heap object]' + '-Wfunction-elimination[Warn about function call elimination]' + '-Wignored-qualifiers[Warn whenever type qualifiers are ignored]' + '-Wimplicit-function-declaration[Warn about implicit function declarations]' + '-Wimplicit-int[Warn when a declaration does not specify a type]' + '-Wimplicit-interface[Warn about calls with implicit interface]' + '-Wimplicit-procedure[Warn about called procedures not explicitly declared]' + '-Wimplicit[Warn about implicit declarations]' + '-Winherited-variadic-ctor[Warn about C++11 inheriting constructors when the base has a variadic constructor]' + '-Winit-self[Warn about variables which are initialized to themselves]' + '-Winline[Warn when an inlined function cannot be inlined]' + '-Wint-to-pointer-cast[Warn when there is a cast to a pointer from an integer of a different size]' + '-Wintrinsic-shadow[Warn if a user-procedure has the same name as an intrinsic]' + '-Wintrinsics-std[Warn on intrinsics not part of the selected standard]' + '-Winvalid-memory-model[Warn when an atomic memory model parameter is known to be outside the valid range]' + '-Winvalid-offsetof[Warn about invalid uses of the "offsetof" macro]' + '-Winvalid-pch[Warn about PCH files that are found but not used]' + '-Wjump-misses-init[Warn when a jump misses a variable initialization]' + '-Wline-truncation[Warn about truncated source lines]' + '-Wliteral-suffix[Warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]' + '-Wlogical-op[Warn when a logical operator is suspiciously always evaluating to true or false]' + '-Wlong-long[Do not warn about using "long long" when -pedantic]' + '-Wmain[Warn about suspicious declarations of "main"]' + '-Wmaybe-uninitialized[Warn about maybe uninitialized automatic variables]' + '-Wmissing-braces[Warn about possibly missing braces around initializers]' + '-Wmissing-declarations[Warn about global functions without previous declarations]' + '-Wmissing-field-initializers[Warn about missing fields in struct initializers]' + '-Wmissing-include-dirs[Warn about user-specified include directories that do not exist]' + '-Wmissing-parameter-type[Warn about function parameters declared without a type specifier in K&R-style functions]' + '-Wmissing-prototypes[Warn about global functions without prototypes]' + '-Wmudflap[Warn about constructs not instrumented by -fmudflap]' + '-Wmultichar[Warn about use of multi-character character constants]' + '-Wnarrowing[Warn about narrowing conversions within { } that are ill-formed in C++11]' + '-Wnested-externs[Warn about "extern" declarations not at file scope]' + '-Wnoexcept[Warn when a noexcept expression evaluates to false even though the expression can'\''t actually throw]' + '-Wnon-template-friend[Warn when non-templatized friend functions are declared within a template]' + '-Wnon-virtual-dtor[Warn about non-virtual destructors]' + '-Wnonnull[Warn about NULL being passed to argument slots marked as requiring non-NULL]' + '-Wold-style-cast[Warn if a C-style cast is used in a program]' + '-Wold-style-declaration[Warn for obsolescent usage in a declaration]' + '-Wold-style-definition[Warn if an old-style parameter definition is used]' + '-Woverflow[Warn about overflow in arithmetic expressions]' + '-Woverlength-strings[Warn if a string is longer than the maximum portable length specified by the standard]' + '-Woverloaded-virtual[Warn about overloaded virtual function names]' + '-Woverride-init[Warn about overriding initializers without side effects]' + '-Wpacked-bitfield-compat[Warn about packed bit-fields whose offset changed in GCC 4.4]' + '-Wpacked[Warn when the packed attribute has no effect on struct layout]' + '-Wpadded[Warn when padding is required to align structure members]' + '-Wparentheses[Warn about possibly missing parentheses]' + '-Wpedantic[Issue warnings needed for strict compliance to the standard]' + '-Wpmf-conversions[Warn when converting the type of pointers to member functions]' + '-Wpointer-arith[Warn about function pointer arithmetic]' + '-Wpointer-sign[Warn when a pointer differs in signedness in an assignment]' + '-Wpointer-to-int-cast[Warn when a pointer is cast to an integer of a different size]' + '-Wpoison-system-directories[Warn for -I and -L options using system directories if cross compiling]' + '-Wpragmas[Warn about misuses of pragmas]' + '-Wproperty-assign-default[Warn if a property for an Objective-C object has no assign semantics specified]' + '-Wprotocol[Warn if inherited methods are unimplemented]' + '-Wreal-q-constant[Warn about real-literal-constants with '\''q'\'' exponent-letter]' + '-Wrealloc-lhs-all[Warn when a left-hand-side variable is reallocated]' + '-Wrealloc-lhs[Warn when a left-hand-side array variable is reallocated]' + '-Wredundant-decls[Warn about multiple declarations of the same object]' + '-Wreorder[Warn when the compiler reorders code]' + '-Wreturn-local-addr[Warn about returning a pointer/reference to a local or temporary variable]' + '-Wreturn-type[Warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]' + '-Wselector[Warn if a selector has multiple methods]' + '-Wsequence-point[Warn about possible violations of sequence point rules]' + '-Wshadow[Warn when one local variable shadows another]' + '-Wsign-compare[Warn about signed-unsigned comparisons]' + '-Wsign-promo[Warn when overload promotes from unsigned to signed]' + '-Wstack-protector[Warn when not issuing stack smashing protection for some reason]' + '-Wstrict-null-sentinel[Warn about uncasted NULL used as sentinel]' + '-Wstrict-prototypes[Warn about unprototyped function declarations]' + '-Wstrict-selector-match[Warn if type signatures of candidate methods do not match exactly]' + '-Wsuggest-attribute=-[Warn about functions which might be candidates for __attribute__((const))]:const: ' + '-Wsurprising[Warn about "suspicious" constructs]' + '-Wswitch-default[Warn about enumerated switches missing a "default-" statement]' + '-Wswitch-enum[Warn about all enumerated switches missing a specific case]' + '-Wswitch[Warn about enumerated switches, with no default, missing a case]' + '-Wsync-nand[Warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]' + '-Wsynth[Deprecated. This switch has no effect]' + '-Wsystem-headers[Do not suppress warnings from system headers]' + '-Wtabs[Permit nonconforming uses of the tab character]' + '-Wtarget-lifetime[Warn if the pointer in a pointer assignment might outlive its target]' + '-Wtraditional-conversion[Warn of prototypes causing type conversions different from what would happen in the absence of prototype]' + '-Wtraditional[Warn about features not present in traditional C]' + '-Wtrampolines[Warn whenever a trampoline is generated]' + '-Wtrigraphs[Warn if trigraphs are encountered that might affect the meaning of the program]' + '-Wtype-limits[Warn if a comparison is always true or always false due to the limited range of the data type]' + '-Wundeclared-selector[Warn about @selector()s without previously declared methods]' + '-Wundef[Warn if an undefined macro is used in an #if directive]' + '-Wunderflow[Warn about underflow of numerical constant expressions]' + '-Wuninitialized[Warn about uninitialized automatic variables]' + '-Wunknown-pragmas[Warn about unrecognized pragmas]' + '-Wunsafe-loop-optimizations[Warn if the loop cannot be optimized due to nontrivial assumptions]' + '-Wunsuffixed-float-constants[Warn about unsuffixed float constants]' + '-Wunused-but-set-parameter[Warn when a function parameter is only set, otherwise unused]' + '-Wunused-but-set-variable[Warn when a variable is only set, otherwise unused]' + '-Wunused-dummy-argument[Warn about unused dummy arguments]' + '-Wunused-function[Warn when a function is unused]' + '-Wunused-label[Warn when a label is unused]' + '-Wunused-local-typedefs[Warn when typedefs locally defined in a function are not used]' + '-Wunused-macros[Warn about macros defined in the main file that are not used]' + '-Wunused-parameter[Warn when a function parameter is unused]' + '-Wunused-result[Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]' + '-Wunused-value[Warn when an expression value is unused]' + '-Wunused-variable[Warn when a variable is unused]' + '-Wunused[Enable all -Wunused- warnings]' + '-Wuseless-cast[Warn about useless casts]' + '-Wvarargs[Warn about questionable usage of the macros used to retrieve variable arguments]' + '-Wvariadic-macros[Warn about using variadic macros]' + '-Wvector-operation-performance[Warn when a vector operation is compiled outside the SIMD]' + '-Wvirtual-move-assign[Warn if a virtual base has a non-trivial move assignment operator]' + '-Wvla[Warn if a variable length array is used]' + '-Wvolatile-register-var[Warn when a register variable is declared volatile]' + '-Wwrite-strings[In C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''. In C, similar warning, except that the conversion is of course not deprecated by the ISO C standard]' + '-Wzero-as-null-pointer-constant[Warn when a literal '\''0'\'' is used as null pointer]' + '-frequire-return-statement[Functions which return values must end with return statements]' +# --help=warnings,joined + '-Wlarger-than=-[Warn if an object is larger than <number> bytes]:number: ' + '-Wnormalized=-[Warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): ' + '-Wstack-usage=-[Warn if stack usage might be larger than specified amount]:stack usage: ' + '-Wstrict-aliasing=-[Warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)' + '-Wstrict-overflow=-[Warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)' +# -W options from --help=common + '-Werror=-[Treat specified warning as error (or all if none specified)]:warning:->werror' + '-Wfatal-errors[Exit on the first error occurred]' + '-Wframe-larger-than=-[Warn if a function'\'\''s stack frame requires more than <number> bytes]:number: ' +) +# optimizers (from --help=optimizers), except for -O +args+=( +# --help=optimizers,^joined + '-faggressive-loop-optimizations[Aggressively optimize loops using language constraints]' + '-falign-functions=-[Align the start of functions]:function alignment' + '-falign-jumps=-[Align labels which are only reached by jumping]:jump alignment' + '-falign-labels=-[Align all labels]:label alignment' + '-falign-loops=-[Align the start of loops]:loop alignment' + '-fasynchronous-unwind-tables[Generate unwind tables that are exact at each instruction boundary]' + '-fbranch-count-reg[Replace add, compare, branch with branch on count register]' + '-fbranch-probabilities[Use profiling information for branch probabilities]' + '-fbranch-target-load-optimize2[Perform branch target load optimization after prologue / epilogue threading]' + '-fbranch-target-load-optimize[Perform branch target load optimization before prologue / epilogue threading]' + '-fbtr-bb-exclusive[Restrict target load migration not to re-use registers in any basic block]' + '-fcaller-saves[Save registers around function calls]' + '-fcombine-stack-adjustments[Looks for opportunities to reduce stack adjustments and stack references]' + '-fcommon[Do not put uninitialized globals in the common section]' + '-fcompare-elim[Perform comparison elimination after register allocation has finished]' + '-fconserve-stack[Do not perform optimizations increasing noticeably stack usage]' + '-fcprop-registers[Perform a register copy-propagation optimization pass]' + '-fcrossjumping[Perform cross-jumping optimization]' + '-fcse-follow-jumps[When running CSE, follow jumps to their targets]' + '-fcx-fortran-rules[Complex multiplication and division follow Fortran rules]' + '-fcx-limited-range[Omit range reduction step when performing complex division]' + '-fdata-sections[Place data items into their own section]' + '-fdce[Use the RTL dead code elimination pass]' + '-fdefer-pop[Defer popping functions args from stack until later]' + '-fdelayed-branch[Attempt to fill delay slots of branch instructions]' + '-fdelete-null-pointer-checks[Delete useless null pointer checks]' + '-fdevirtualize[Try to convert virtual calls to direct ones]' + '-fdse[Use the RTL dead store elimination pass]' + '-fearly-inlining[Perform early inlining]' + '-fexceptions[Enable exception handling]' + '-fexpensive-optimizations[Perform a number of minor, expensive optimizations]' + '-ffinite-math-only[Assume no NaNs or infinities are generated]' + '-ffloat-store[Don'\''t allocate floats and doubles in extended- precision registers]' + '-fforward-propagate[Perform a forward propagation pass on RTL]' + '-fgcse-after-reload[Perform global common subexpression elimination after register allocation has finished]' + '-fgcse-las[Perform redundant load after store elimination in global common subexpression elimination]' + '-fgcse-lm[Perform enhanced load motion during global common subexpression elimination]' + '-fgcse-sm[Perform store motion after global common subexpression elimination]' + '-fgcse[Perform global common subexpression elimination]' + '-fgraphite-identity[Enable Graphite Identity transformation]' + '-fguess-branch-probability[Enable guessing of branch probabilities]' + '-fhandle-exceptions[This switch lacks documentation]' + '-fhoist-adjacent-loads[Enable hoisting adjacent loads to encourage generating conditional move instructions]' + '-fif-conversion2[Perform conversion of conditional jumps to conditional execution]' + '-fif-conversion[Perform conversion of conditional jumps to branchless equivalents]' + '-finline-atomics[Inline __atomic operations when a lock free instruction sequence is available]' + '-finline-functions-called-once[Integrate functions only required by their single caller]' + '-finline-functions[Integrate functions not declared "inline" into their callers when profitable]' + '-finline-small-functions[Integrate functions into their callers when code size is known not to grow]' + '-finline[Enable inlining of function declared "inline", disabling disables all inlining]' + '-fipa-cp-clone[Perform cloning to make Interprocedural constant propagation stronger]' + '-fipa-cp[Perform Interprocedural constant propagation]' + '-fipa-profile[Perform interprocedural profile propagation]' + '-fipa-pta[Perform interprocedural points-to analysis]' + '-fipa-pure-const[Discover pure and const functions]' + '-fipa-reference[Discover readonly and non addressable static variables]' + '-fipa-sra[Perform interprocedural reduction of aggregates]' + '-fira-hoist-pressure[Use IRA based register pressure calculation in RTL hoist optimizations]' + '-fivopts[Optimize induction variables on trees]' + '-fjump-tables[Use jump tables for sufficiently large switch statements]' + '-floop-block[Enable Loop Blocking transformation]' + '-floop-interchange[Enable Loop Interchange transformation]' + '-floop-nest-optimize[Enable the ISL based loop nest optimizer]' + '-floop-parallelize-all[Mark all loops as parallel]' + '-floop-strip-mine[Enable Loop Strip Mining transformation]' + '-fmath-errno[Set errno after built-in math functions]' + '-fmerge-all-constants[Attempt to merge identical constants and constant variables]' + '-fmerge-constants[Attempt to merge identical constants across compilation units]' + '-fmodulo-sched[Perform SMS based modulo scheduling before the first scheduling pass]' + '-fmove-loop-invariants[Move loop invariant computations out of loops]' + '-fno-threadsafe-statics[Do not generate thread-safe code for initializing local statics]' + '-fnon-call-exceptions[Support synchronous non-call exceptions]' + '-fnothrow-opt[Treat a throw() exception specification as noexcept to improve code size]' + '-fomit-frame-pointer[When possible do not generate stack frames]' + '-fopt-info[Enable all optimization info dumps on stderr]' + '-foptimize-register-move[Do the full register move optimization pass]' + '-foptimize-sibling-calls[Optimize sibling and tail recursive calls]' + '-foptimize-strlen[Enable string length optimizations on trees]' + '-fpack-struct[Pack structure members together without holes]' + '-fpeel-loops[Perform loop peeling]' + '-fpeephole2[Enable an RTL peephole pass before sched2]' + '-fpeephole[Enable machine specific peephole optimizations]' + '-fpredictive-commoning[Run predictive commoning optimization]' + '-fprefetch-loop-arrays[Generate prefetch instructions, if available, for arrays in loops]' + '-freg-struct-return[Return small aggregates in registers]' + '-fregmove[Enables a register move optimization]' + '-frename-registers[Perform a register renaming optimization pass]' + '-freorder-blocks-and-partition[Reorder basic blocks and partition into hot and cold sections]' + '-freorder-blocks[Reorder basic blocks to improve code placement]' + '-freorder-functions[Reorder functions to improve code placement]' + '-frerun-cse-after-loop[Add a common subexpression elimination pass after loop optimizations]' + '-freschedule-modulo-scheduled-loops[Enable/Disable the traditional scheduling in loops that already passed modulo scheduling]' + '-frounding-math[Disable optimizations that assume default FP rounding behavior]' + '-frtti[Generate run time type descriptor information]' + '-fsched-critical-path-heuristic[Enable the critical path heuristic in the scheduler]' + '-fsched-dep-count-heuristic[Enable the dependent count heuristic in the scheduler]' + '-fsched-group-heuristic[Enable the group heuristic in the scheduler]' + '-fsched-interblock[Enable scheduling across basic blocks]' + '-fsched-last-insn-heuristic[Enable the last instruction heuristic in the scheduler]' + '-fsched-pressure[Enable register pressure sensitive insn scheduling]' + '-fsched-rank-heuristic[Enable the rank heuristic in the scheduler]' + '-fsched-spec-insn-heuristic[Enable the speculative instruction heuristic in the scheduler]' + '-fsched-spec-load-dangerous[Allow speculative motion of more loads]' + '-fsched-spec-load[Allow speculative motion of some loads]' + '-fsched-spec[Allow speculative motion of non-loads]' + '-fsched2-use-superblocks[If scheduling post reload, do superblock scheduling]' + '-fschedule-insns2[Reschedule instructions after register allocation]' + '-fschedule-insns[Reschedule instructions before register allocation]' + '-fsection-anchors[Access data in the same section from shared anchor points]' + '-fsel-sched-pipelining-outer-loops[Perform software pipelining of outer loops during selective scheduling]' + '-fsel-sched-pipelining[Perform software pipelining of inner loops during selective scheduling]' + '-fsel-sched-reschedule-pipelined[Reschedule pipelined regions without pipelining]' + '-fselective-scheduling2[Run selective scheduling after reload]' + '-fselective-scheduling[Schedule instructions using selective scheduling algorithm]' + '-fshort-double[Use the same size for double as for float]' + '-fshort-enums[Use the narrowest integer type possible for enumeration types]' + '-fshort-wchar[Force the underlying type for "wchar_t" to be "unsigned short"]' + '-fshrink-wrap[Emit function prologues only before parts of the function that need it, rather than at the top of the function]' + '-fsignaling-nans[Disable optimizations observable by IEEE signaling NaNs]' + '-fsigned-zeros[Disable floating point optimizations that ignore the IEEE signedness of zero]' + '-fsingle-precision-constant[Convert floating point constants to single precision constants]' + '-fsplit-ivs-in-unroller[Split lifetimes of induction variables when loops are unrolled]' + '-fsplit-wide-types[Split wide types into independent registers]' + '-fstrict-aliasing[Assume strict aliasing rules apply]' + '-fstrict-enums[Assume that values of enumeration type are always within the minimum range of that type]' + '-fthread-jumps[Perform jump threading optimizations]' + '-ftoplevel-reorder[Reorder top level functions, variables, and asms]' + '-ftrapping-math[Assume floating-point operations can trap]' + '-ftrapv[Trap for signed overflow in addition, subtraction and multiplication]' + '-ftree-bit-ccp[Enable SSA-BIT-CCP optimization on trees]' + '-ftree-builtin-call-dce[Enable conditional dead code elimination for builtin calls]' + '-ftree-ccp[Enable SSA-CCP optimization on trees]' + '-ftree-ch[Enable loop header copying on trees]' + '-ftree-coalesce-inlined-vars[Enable coalescing of copy-related user variables that are inlined]' + '-ftree-coalesce-vars[Enable coalescing of all copy-related user variables]' + '-ftree-copy-prop[Enable copy propagation on trees]' + '-ftree-copyrename[Replace SSA temporaries with better names in copies]' + '-ftree-cselim[Transform condition stores into unconditional ones]' + '-ftree-dce[Enable SSA dead code elimination optimization on trees]' + '-ftree-dominator-opts[Enable dominator optimizations]' + '-ftree-dse[Enable dead store elimination]' + '-ftree-forwprop[Enable forward propagation on trees]' + '-ftree-fre[Enable Full Redundancy Elimination (FRE) on trees]' + '-ftree-loop-distribute-patterns[Enable loop distribution for patterns transformed into a library call]' + '-ftree-loop-distribution[Enable loop distribution on trees]' + '-ftree-loop-if-convert-stores[Also if-convert conditional jumps containing memory writes]' + '-ftree-loop-if-convert[Convert conditional jumps in innermost loops to branchless equivalents]' + '-ftree-loop-im[Enable loop invariant motion on trees]' + '-ftree-loop-ivcanon[Create canonical induction variables in loops]' + '-ftree-loop-optimize[Enable loop optimizations on tree level]' + '-ftree-lrs[Perform live range splitting during the SSA- >normal pass]' + '-ftree-partial-pre[In SSA-PRE optimization on trees, enable partial- partial redundancy elimination]' + '-ftree-phiprop[Enable hoisting loads from conditional pointers]' + '-ftree-pre[Enable SSA-PRE optimization on trees]' + '-ftree-pta[Perform function-local points-to analysis on trees]' + '-ftree-reassoc[Enable reassociation on tree level]' + '-ftree-scev-cprop[Enable copy propagation of scalar-evolution information]' + '-ftree-sink[Enable SSA code sinking on trees]' + '-ftree-slp-vectorize[Enable basic block vectorization (SLP) on trees]' + '-ftree-slsr[Perform straight-line strength reduction]' + '-ftree-sra[Perform scalar replacement of aggregates]' + '-ftree-switch-conversion[Perform conversions of switch initializations]' + '-ftree-tail-merge[Enable tail merging on trees]' + '-ftree-ter[Replace temporary expressions in the SSA->normal pass]' + '-ftree-vect-loop-version[Enable loop versioning when doing loop vectorization on trees]' + '-ftree-vectorize[Enable loop vectorization on trees]' + '-ftree-vrp[Perform Value Range Propagation on trees]' + '-funit-at-a-time[Compile whole compilation unit at a time]' + '-funroll-all-loops[Perform loop unrolling for all loops]' + '-funroll-loops[Perform loop unrolling when iteration count is known]' + '-funsafe-loop-optimizations[Allow loop optimizations to assume that the loops behave in normal way]' + '-funsafe-math-optimizations[Allow math optimizations that may violate IEEE or ISO standards]' + '-funswitch-loops[Perform loop unswitching]' + '-funwind-tables[Just generate unwind tables for exception handling]' + '-fvar-tracking-assignments-toggle[Toggle -fvar-tracking-assignments]' + '-fvar-tracking-assignments[Perform variable tracking by annotating assignments]' + '-fvar-tracking-uninit[Perform variable tracking and also tag variables that are uninitialized]' + '-fvar-tracking[Perform variable tracking]' + '-fvariable-expansion-in-unroller[Apply variable expansion when loops are unrolled]' + '-fvect-cost-model[Enable use of cost model in vectorization]' + '-fvpt[Use expression value profiles in optimizations]' + '-fweb[Construct webs and split unrelated uses of single variable]' + '-fwhole-program[Perform whole program optimizations]' + '-fwrapv[Assume signed arithmetic overflow wraps around]' +# --help=optimizers,joined + '-fpack-struct=-[Set initial maximum structure member alignment]:alignment: ' +) -_arguments -C -M 'L:|-{fW}no-=-{fW} r:|[_-]=* r:|=*' \ +# other common options, gcc --help=warnings --help=optimizers --help=common|sed 1,/language-independent/d +args+=( +# | grep -v :: + '--debug[This switch lacks documentation]' + '--dump[This switch lacks documentation]' + '--dumpbase[This switch lacks documentation]' + '--dumpdir[This switch lacks documentation]' + '--help[Display this information]' + '--no-warnings[This switch lacks documentation]' + '--optimize[This switch lacks documentation]' + '--output[This switch lacks documentation]' + '--param[Set parameter <param> to value. See manpage for a complete list of parameters]:name=value' + '--pedantic-errors[This switch lacks documentation]' + '--pedantic[This switch lacks documentation]' + '--profile[This switch lacks documentation]' + '--verbose[This switch lacks documentation]' + '--version[This switch lacks documentation]' + '-aux-info[Emit declaration information into <file>]:file:_files' + '-dumpbase[Set the file basename to be used for dumps]' + '-dumpdir[Set the directory name to be used for dumps]' + '-fPIC[Generate position-independent code if possible (large mode)]' + '-fPIE[Generate position-independent code for executables if possible (large mode)]' + '-fassociative-math[Allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]' + '-fauto-inc-dec[Generate auto-inc/dec instructions]' + '-fbounds-check[Generate code to check bounds before indexing arrays]' + '-fcall-saved--[Mark <register> as being preserved across functions]:register' + '-fcall-used--[Mark <register> as being corrupted by function calls]:register' + '-fcheck-data-deps[Compare the results of several data dependence analyzers]' + '-fcompare-debug-second[Run only the second compilation of -fcompare-debug]' + '-fcompare-debug=[Compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' #TODO: complete gcc options here + '-fdbg-cnt-list[List all available debugging counters with their limits and counts]' + '-fdbg-cnt=[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' #TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c + '-fdebug-types-section[Output .debug_types section when using DWARF v4 debuginfo]' + '-fdelete-dead-exceptions[Delete dead instructions that may throw exceptions]' + '-fdiagnostics-show-caret[Show the source line with a caret indicating the column]' + '-fdiagnostics-show-location=-[How often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)' + '-fdiagnostics-show-option[Amend appropriate diagnostic messages with the command line option that controls them]' + #not meant for end users + #'-fdisable--pass=[disables an optimization pass]:range1+range2: ' + #'-fdisable-[disables an optimization pass]' + #'-fenable--pass=[enables an optimization pass]:range1+range2: ' + #'-fenable-[enables an optimization pass]' + #'-fdump-<type>[Dump various compiler internals to a file]' + '-fdump-final-insns=-[Dump to filename the insns at the end of translation]:filename:_files' + '-fdump-go-spec=-[Write all declarations to file as Go code]:filename:_files' + '-fdump-noaddr[Suppress output of addresses in debugging dumps]' + '-fdump-passes[Dump optimization passes]' + '-fdump-unnumbered-links[Suppress output of previous and next insn numbers in debugging dumps]' + '-fdump-unnumbered[Suppress output of instruction numbers, line number notes and addresses in debugging dumps]' + '-fdwarf2-cfi-asm[Enable CFI tables via GAS assembler directives]' + '-feliminate-dwarf2-dups[Perform DWARF2 duplicate elimination]' + '-feliminate-unused-debug-symbols[Perform unused type elimination in debug info]' + '-feliminate-unused-debug-types[Perform unused type elimination in debug info]' + '-femit-class-debug-always[Do not suppress C++ class debug information]' + '-fexcess-precision=-[Specify handling of excess floating-point precision]:precision handling:(fast standard)' + '-ffast-math[Sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]' + '-ffat-lto-objects[Output lto objects containing both the intermediate language and binary output]' + '-ffixed--[Mark <register> as being unavailable to the compiler]:register' + '-ffunction-cse[Allow function addresses to be held in registers]' + '-ffunction-sections[Place each function into its own section]' + '-fgnu-tm[Enable support for GNU transactional memory]' + '-fgraphite[Enable in and out of Graphite representation]' + '-fident[Process #ident directives]' + '-findirect-inlining[Perform indirect inlining]' + '-finhibit-size-directive[Do not generate .size directives]' + '-finline-limit=[Limit the size of inlined functions to <number>]:number: ' + '-finstrument-functions[Instrument function entry and exit with profiling calls]' + '-fira-loop-pressure[Use IRA based register pressure calculation in RTL loop optimizations]' + '-fira-share-save-slots[Share slots for saving different hard registers]' + '-fira-share-spill-slots[Share stack slots for spilled pseudo-registers]' + '-fira-verbose=[Control IRA'\''s level of diagnostic messages]:verbosity: ' + '-fkeep-inline-functions[Generate code for functions even if they are fully inlined]' + '-fkeep-static-consts[Emit static const variables even if they are not used]' + '-fleading-underscore[Give external symbols a leading underscore]' + '-flto-compression-level=[Use zlib compression level <number> for IL]:compression level: ' + '-flto-partition=[Partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max)' + '-flto-report[Report various link-time optimization statistics]' + '-flto[Enable link-time optimization]' + '-fmax-errors=-[Maximum number of errors to report]:errors: ' + '-fmem-report-wpa[Report on permanent memory allocation in WPA only]' + '-fmem-report[Report on permanent memory allocation]' + '-fmerge-debug-strings[Attempt to merge identical debug strings across compilation units]' + '-fmessage-length=-[Limit diagnostics to <number> characters per line. 0 suppresses line-wrapping]:length: ' + '-fmodulo-sched-allow-regmoves[Perform SMS based modulo scheduling with register moves allowed]' + '-fopt-info-type=-[Dump compiler optimization details]:filename:_files' + '-fopt-info[Dump compiler optimization details]' + '-fpartial-inlining[Perform partial inlining]' + '-fpcc-struct-return[Return small aggregates in memory, not registers]' + '-fpic[Generate position-independent code if possible (small mode)]' + '-fpie[Generate position-independent code for executables if possible (small mode)]' + '-fplugin-arg--[Specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO + '-fpost-ipa-mem-report[Report on memory allocation before interprocedural optimization]' + '-fpre-ipa-mem-report[Report on memory allocation before interprocedural optimization]' + '-fprofile-arcs[Insert arc-based program profiling code]' + '-fprofile-correction[Enable correction of flow inconsistent profile data input]' + '-fprofile-generate[Enable common options for generating profile info for profile feedback directed optimizations]' + '-fprofile-report[Report on consistency of profile]' + '-fprofile-use[Enable common options for performing profile feedback directed optimizations]' + '-fprofile-values[Insert code to profile values of expressions]' + '-fprofile[Enable basic program profiling code]' + '-frandom-seed=-[Use <string> as random seed]:seed: ' + '-freciprocal-math[Same as -fassociative-math for expressions which include division]' + '-frecord-gcc-switches[Record gcc command line switches in the object file]' + '-free[Turn on Redundant Extensions Elimination pass]' + '-fsanitize=-[Enable AddressSanitizer, a memory error detector]:style:(address thread)' + '-fsched-stalled-insns-dep=-[Set dependence distance checking in premature scheduling of queued insns]:instructions: ' + '-fsched-stalled-insns=-[Set number of queued insns that can be prematurely scheduled]:instructions: ' + '-fsched-verbose=-[Set the verbosity level of the scheduler]:verbosity: ' + '-fshow-column[Show column numbers in diagnostics, when available]' + '-fsplit-stack[Generate discontiguous stack frames]' + '-fstack-check=-[Insert stack checking code into the program. -fstack-check=specific if to argument given]:type:(none generic specific)' + '-fstack-limit-register=-[Trap if the stack goes past <register>]:register: ' + '-fstack-limit-symbol=-[Trap if the stack goes past symbol <name>]:name: ' + '-fno-stack-limit' + '-fstack-protector-all[Use a stack protection method for every function]' + '-fstack-protector[Use propolice as a stack protection method]' + '-fstack-usage[Output stack usage information on a per-function basis]' + '-fstrict-overflow[Treat signed overflow as undefined]' + '-fstrict-volatile-bitfields[Force bitfield accesses to match their type width]' + '-fsync-libcalls[Implement __atomic operations via libcalls to legacy __sync functions]' + '-fsyntax-only[Check for syntax errors, then stop]' + '-ftest-coverage[Create data files needed by "gcov"]' + '-ftime-report[Report the time taken by each compiler pass]' + '-ftls-model=-[Set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)' + '-ftracer[Perform superblock formation via tail duplication]' + '-ftree-loop-linear[Enable loop interchange transforms. Same as -floop-interchange]' + '-fuse-ld=[Use the specified linker instead of the default linker]:linker:(bfd gold)' + '-fuse-linker-plugin[Use linker plugin during link-time optimization]' + '-fverbose-asm[Add extra commentary to assembler output]' + '-fvisibility=[Set the default symbol visibility]:visibility:(default internal hidden protected)' + '-fzero-initialized-in-bss[Put zero initialized data in the bss section]' + '-gno-pubnames[Don'\''t generate DWARF pubnames and pubtypes sections]' + '-gno-record-gcc-switches[Don'\''t record gcc command line switches in DWARF DW_AT_producer]' + '-gno-split-dwarf[Don'\''t generate debug information in separate .dwo files]' + '-gno-strict-dwarf[Emit DWARF additions beyond selected version]' + '-gpubnames[Generate DWARF pubnames and pubtypes sections]' + '-grecord-gcc-switches[Record gcc command line switches in DWARF DW_AT_producer]' + '-gsplit-dwarf[Generate debug information in separate .dwo files]' + '-gstrict-dwarf[Don'\''t emit DWARF additions beyond selected version]' + '-gtoggle[Toggle debug information generation]' + '-gvms[Generate debug information in VMS format]' + '-imultiarch[Set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage + '-iplugindir=[Set <dir> to be the default plugin directory]:directory:_files -/' + '(-pg)-p[Enable function profiling for prof]' + '(-p)-pg[Enable function profiling for gprof]' + '-pedantic-errors[Like -pedantic but issue them as errors]' + '-pedantic[Issue all mandatory diagnostics in the C standard]' + '-quiet[Do not display functions compiled or elapsed time]' + '-v[Enable verbose output]' + '-version[Display the compiler'\''s version]' + '-w[Suppress warnings]' +# | grep :: + '-fabi-version=-[Use version <n> of the C++ ABI (default: 2)]:ABI version:(1 2 3 4 5 6)' + '-fdebug-prefix-map=-[Map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir' + '-ffp-contract=-[Perform floating- point expression contraction (default: fast)]:style:(on off fast)' + '-finstrument-functions-exclude-file-list=-[Do not instrument functions listed in files]:comma-separated file list:->commafiles' + '-finstrument-functions-exclude-function-list=-[Do not instrument listed functions]:comma-separated list of syms: ' + '-fira-algorithm=-[Set the used IRA algorithm]:algorithm:(priority CB)' + '-fira-region=-[Set regions for IRA]:region:(all mixed one)' + '-fplugin=-[Specify a plugin to load]:plugin: ' # TODO: complete plugins? + '-fprofile-dir=-[Set the top-level directory for storing the profile data]:profile directory:_files -/' + '-fstack-reuse=-[Set stack reuse level for local variables]:reuse-level:(all named_vars none)' + '-ftree-parallelize-loops=-[Enable automatic parallelization of loops]:threads: ' +) + +# How to mostly autogenerate the above stuff: +# joinhelplines() { sed '$!N;s/^\( -.*\)\n \s*\([^-]\)/\1 \2/;P;D' } +# gcc-x86() { gcc --help=target,\^undocumented | joinhelplines | joinhelplines } +# compdef _gnu_generic gcc-x86 +# printf '%s\n' ${(onq-)_args_cache_gcc_x86} +_arguments -C -M 'L:|-{fWm}no-=-{fWm} r:|[_-]=* r:|=*' \ "$args[@]" \ - -c -S -E -v -a -w -C -H -P -s '(-pg)-p' '(-p)-pg' \ - '-###[print commands to run this compilation]' \ - '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"' \ - '-x:input file language:(c objective-c c++ c-header cpp-output c++-cpp-output assembler assembler-with-cpp none)' \ - '+e-:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))' \ - '-d-:dump:->dump' \ - '-g-::debugging information type:(gdb coff stabs stabs+ dwarf dwarf+ xcoff xcoff+)' \ - '-O-::optimization level:(0 1 2 3)' \ - '*-M-::output dependencies:((M\:only\ user\ header\ files MD\:output\ to\ file G\:treat\ missing\ header\ files\ as\ generated))' \ - '*-A-:define assertion:' \ - '*-D-:define macro:' \ - '*-U-:undefine macro:' \ - '*-Wp,-:preprocessor option:' \ - '*-Wl,-:linker option:' \ - '*-Xpreprocessor:preprocessor option:' \ - '*-Xlinker:linker option:' \ - '*-u:pretend symbol to be undefined:' \ - '*-Wa,-:assembler option:' \ - '*-l:library:->library' \ - '*-L-:library search path:_files -/' \ - '*-I-:header file search path:_files -/' \ - '-B-:executable prefix:_files -/' \ - '-b:target machine:' \ - '-V:specify compiler version:' \ - '--version' \ - '-print-file-name=:library:->library' \ - '-print-prog-name=:program:' \ - '*-include:include file:_files -g \*.h\(-.\)' \ - '*-imacros:macro input file:_files -g \*.h\(-.\)' \ - '*-idirafter:second include path directory:_files -/' \ - '*-iprefix:prefix:_files' \ - '*-iwithprefix:second include path directory:_files -/' \ - '*-iwithprefixbefore:main include path directory:_files -/' \ - '*-isystem:second include path directory (system):_files -/' \ - -nostdinc -trigraphs -undef -pipe -ansi \ - -fallow-single-precision -fcond-mismatch -fasm \ - -fbuiltin -fsigned-bitfields -fsigned-char \ - -funsigned-bitfields -funsigned-char -fwritable-strings \ - -traditional -traditional-cpp -trigraphs \ - -fall-virtual -fdollars-in-identifiers -felide-constructors \ - -fenum-int-equiv -fexternal-templates -ffor-scope \ - -fhandle-signatures -fmemoize-lookups -fdefault-inline -fgnu-keywords \ - -fnonnull-objects -foperator-names -fstrict-prototype \ - -fthis-is-variable -nostdinc++ -traditional \ - -fsyntax-only -pedantic -pedantic-errors \ - -Wall -Waggregate-return -Wbad-function-cast \ - -Wcast-align -Wcast-qual -Wchar-subscript -Wcomment \ - -Wconversion -Wenum-clash -Werror -Wformat \ - '-Wid-clash--:minimum identifier difference length:' \ - -Wimplicit -Wimport -Winline \ - '-Wlarger-than--:maximum object length:' \ - -Wmissing-declarations \ - -Wmissing-prototypes -Wnested-externs \ - -Wimport -Woverloaded-virtual -Wparentheses \ - -Wpointer-arith -Wredundant-decls -Wreorder -Wreturn-type -Wshadow \ - -Wstrict-prototypes -Wswitch -Wsynth -Wtemplate-debugging \ - -Wtraditional -Wtrigraphs -Wuninitialized -Wunused \ - -Wwrite-strings \ - -fpretend-float \ - -print-libgcc-file-name \ - -print-search-dirs -save-temps \ - -fcaller-saves -fcse-follow-jumps -fcse-skip-blocks \ - -fdelayed-branch -fexpensive-optimizations \ - -ffast-math -ffloat-store -fforce-addr -fforce-mem \ - -finline-functions -fkeep-inline-functions \ - -fdefault-inline -fdefer-pop -ffunction-cse \ - -finline -fpeephole -fomit-frame-pointer \ - -frerun-cse-after-loop -fschedule-insns \ - -fschedule-insns2 -fstrength-reduce -fthread-jumps \ - -funroll-all-loops -funroll-loops \ - -nostartfiles -nodefaultlibs -nostdlib \ - -static -shared -symbolic \ - '*-fcall-saved--:register saved by function call:' \ - '*-fcall-used--:register clobbered by function call:' \ - '*-ffixed--:fixed register:' \ - -finhibit-size-directive \ - -fno-common -fno-ident -fno-gnu-linker \ - -fpcc-struct-return -fpic -fPIC \ - -freg-struct-return -fshared-data -fshort-enums \ - -fshort-double -fvolatile -fvolatile-global \ - -fverbose-asm -fpack-struct \ "$args2[@]" && ret=0 @@ -342,7 +971,22 @@ library) rundir) compset -P '*:' compset -S ':*' - _files -/ -S/ -r '\n\t\- /:' "$@" + _files -/ -S/ -r '\n\t\- /:' "$@" && ret=0 + ;; +help) + _values -s , 'help' \ + optimizers warnings target params common \ + c c++ objc objc++ lto ada adascil adawhy fortran go java \ + {\^,}undocumented {\^,}joined {\^,}separate \ + && ret=0 + ;; +dirtodir) + compset -P '*=' + _files -/ && ret=0 + ;; +commafiles) + compset -P '*,' + _files && ret=0 ;; esac diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 43a01d9ff..7cd3324a8 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -405,8 +405,9 @@ _git-check-ignore () { '(-q --quiet)'{-q,--quiet}'[do not output anything, just set exit status]' \ '(-v --verbose)'{-v,--verbose}'[output details about the matching pattern (if any) for each pathname]' \ '--stdin[read file names from stdin instead of from the command-line]' \ - '-z[make output format machine-parseable]' \ + '-z[make output format machine-parseable and treat input-paths as NUL-separated with --stdin]' \ '(-n --non-matching)'{-n,--non-matching}'[show given paths which do not match any pattern]' \ + '--no-index[do not look in the index when undertaking the checks]' \ '*:: :->file' && ret=0 } @@ -422,7 +423,7 @@ _git-checkout () { # and perhaps also allow all that just with ^{tree} and so on. Not quite sure # how to do that, though. local new_branch_reflog_opt - if (( words[(I)-b|-B] )); then + if (( words[(I)-b|-B|--orphan] )); then new_branch_reflog_opt="(--patch)-l[create the new branch's reflog]" fi @@ -434,12 +435,13 @@ _git-checkout () { '(-f --force -m --merge --conflict --patch)'{-f,--force}'[force branch switch/ignore unmerged entries]' \ '(-q --quiet --theirs --patch)--ours[check out stage #2 for unmerged paths]' \ '(-q --quiet --ours --patch)--theirs[check out stage #3 for unmerged paths]' \ - '( -B --orphan --ours --theirs --conflict --patch)-b[create a new branch based at given commit]: :__git_branch_names' \ - '(-b --orphan --ours --theirs --conflict --patch)-B[create or update branch based at given commit]: :__git_branch_names' \ - '(-t --track --orphan --patch)'{-t,--track}'[set up configuration so pull merges from the base commit]' \ + '( -B --orphan --ours --theirs --conflict --patch --detach)-b[create a new branch based at given commit]: :__git_branch_names' \ + '(-b --orphan --ours --theirs --conflict --patch --detach)-B[create or update branch based at given commit]: :__git_branch_names' \ + '(-t --track --orphan --patch --detach)'{-t,--track}'[set up configuration so pull merges from the base commit]' \ '(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \ $new_branch_reflog_opt \ - '(-b -B -t --track --patch)--orphan[create a new orphan branch based at given commit]: :__git_branch_names' \ + '(-b -B -t --track --patch --orphan)--detach[detach the HEAD at named commit]' \ + '(-b -B -t --track --patch --detach)--orphan[create a new orphan branch based at given commit]: :__git_branch_names' \ '--ignore-skip-worktree-bits[ignores patterns and adds back any files in <paths>]' \ '(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \ '(-q --quiet -f --force -m --merge --patch)--conflict[same as --merge, using given merge style]:style:(merge diff3)' \ @@ -461,7 +463,7 @@ _git-checkout () { tree_ish_arg='tree-ishs::__git_tree_ishs' \ file_arg='modified-files::__git_modified_files' - if [[ -n ${opt_args[(I)-b|-B|--orphan]} ]]; then + if [[ -n ${opt_args[(I)-b|-B|--orphan|--detach]} ]]; then remote_branch_noprefix_arg= tree_ish_arg= file_arg= @@ -480,7 +482,7 @@ _git-checkout () { $remote_branch_noprefix_arg \ $tree_ish_arg \ $file_arg && ret=0 - elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan]} ]]; then + elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan|--detach]} ]]; then _nothing elif [[ -n $line[1] ]] && __git_is_treeish $line[1]; then __git_ignore_line __git_tree_files ${PREFIX:-.} $line[1] && ret=0 @@ -509,7 +511,7 @@ _git-cherry-pick () { '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ - ': :__git_revisions' + ': :__git_commit_ranges' } (( $+functions[_git-citool] )) || @@ -722,63 +724,74 @@ _git-diff () { case $state in (from-to-file) + # If "--" is part of $opt_args, this means it was specified before any + # $words arguments. This means that no heads are specified in front, so + # we need to complete *changed* files only. + if [[ -n ${opt_args[(I)--]} ]]; then + if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then + __git_changed-in-index_files && ret=0 + else + __git_changed-in-working-tree_files && ret=0 + fi + return ret + fi + + # Otherwise, more complex conditions need to be checked. case $CURRENT in (1) - if [[ -n ${opt_args[(I)--]} ]]; then - if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then - __git_changed-in-index_files && ret=0 - else - __git_changed-in-working-tree_files && ret=0 - fi - else - local files_alt='files::__git_changed-in-working-tree_files' - - if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then - files_alt='files::__git_changed-in-index_files' - fi - - _alternative \ - 'commit-ranges::__git_commit_ranges' \ - 'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \ - $files_alt \ - 'blobs::__git_blobs ' && ret=0 + local files_alt='files::__git_changed-in-working-tree_files' + if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then + files_alt='files::__git_changed-in-index_files' fi + + _alternative \ + 'commit-ranges::__git_commit_ranges' \ + 'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \ + $files_alt \ + 'blobs::__git_blobs ' && ret=0 ;; (2) + # Check if first argument is something special. In case of committish ranges and committishs offer a full list compatible completions. if __git_is_committish_range $line[1]; then + # Example: git diff branch1..branch2 <tab> __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0 elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then - if [[ -n ${opt_args[(I)--]} ]]; then - __git_changed-in-working-tree_files && ret=0 - else - _alternative \ - 'commits::__git_commits' \ - 'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \ - 'files::__git_changed-in-working-tree_files' && ret=0 - fi + # Example: git diff branch1 <tab> + _alternative \ + 'commits::__git_commits' \ + 'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \ + 'files::__git_tree_files ${PREFIX:-.} HEAD' && ret=0 elif __git_is_blob $line[1]; then - if [[ -n ${opt_args[(I)--]} ]]; then - __git_cached_files && ret=0 - else - _alternative \ - 'files::__git_cached_files' \ - 'blobs::__git_blobs' && ret=0 - fi + _alternative \ + 'files::__git_cached_files' \ + 'blobs::__git_blobs' && ret=0 elif [[ -n ${opt_args[(I)--cached|--staged]} ]]; then + # Example: git diff --cached file1 <tab> __git_changed-in-index_files && ret=0 else + # Example: git diff file1 <tab> __git_changed-in-working-tree_files && ret=0 fi ;; (*) if __git_is_committish_range $line[1]; then + # Example: git diff branch1..branch2 file1 <tab> __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0 elif { __git_is_committish $line[1] && __git_is_committish $line[2] } || __git_is_treeish $line[2]; then + # Example: git diff branch1 branch2 <tab> __git_tree_files ${PREFIX:-.} $line[2] && ret=0 + elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then + # Example: git diff branch file1 <tab> + # Example: git diff branch -- f<tab> + __git_tree_files ${PREFIX:-.} HEAD && ret=0 elif __git_is_blob $line[1] && __git_is_blob $line[2]; then _nothing + elif [[ -n ${opt_args[(I)--cached|--staged]} ]]; then + # Example: git diff --cached file1 file2 <tab> + __git_changed-in-index_files && ret=0 else + # Example: git diff file1 file2 <tab> __git_changed-in-working-tree_files && ret=0 fi ;; @@ -911,6 +924,8 @@ _git-grep () { '(--no-exclude-standard)--exclude-standard[exclude files standard ignore mechanisms]' \ '--untracked[search in untracked files]' \ '(-a --text)'{-a,--text}'[process binary files as if they were text]' \ + '(--textconv --no-textconv)--textconv[honor textconv filter settings]' \ + '(--textconv --no-textconv)--no-textconv[do not honor textconv filter settings]' \ '(-i --ignore-case)'{-i,--ignore-case}'[ignore case when matching]' \ '-I[do not match pattern in binary files]' \ '--max-depth=[descend at most given levels of directories]: :__git_guard_number depth' \ @@ -1230,8 +1245,10 @@ _git-pull () { _arguments \ $merge_options \ - '( --no-rebase)--rebase[perform a rebase after fetching]' \ - '(--rebase )--no-rebase[do not perform a rebase after fetching]' \ + '(-r --rebase --no-rebase)'{-r=-,--rebase=-}'[perform a rebase after fetching]::rebase after fetching:((true\:"rebase after fetching" + false\:"merge after fetching" + preserve\:"rebase and preserve merges"))' \ + '(-r --rebase )--no-rebase[do not perform a rebase after fetching]' \ $fetch_options \ ': :__git_any_repositories' \ '*: :__git_ref_specs' @@ -1239,6 +1256,7 @@ _git-pull () { (( $+functions[_git-push] )) || _git-push () { + local ret=1 # NOTE: For --receive-pack we use _files to complete, even though this will # only complete files on the local end, not the remote end. Still, it may be # helpful to get some sort of completion going, perhaps modifying the path @@ -1253,9 +1271,11 @@ _git-push () { '--tags[all tags under refs/tags are pushed]' \ '--follow-tags[also push missing annotated tags reachable from the pushed refs]' \ '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \ + '(--force-with-lease --no-force-with-lease)*--force-with-lease=-[allow refs that are not ancestors to be updated if current ref matches expected value]::ref and expectation:->lease' \ + '(--force-with-lease --no-force-with-lease)--no-force-with-lease=-[cancel all previous force-with-lease specifications]' \ '(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' \ '(:)--repo=[default repository to use]:repository:__git_any_repositories' \ - '(-u --set-upstream-to)'{-u,--set-upstream-to}'[add upstream reference for each branch that is up to date or pushed]' \ + '(-u --set-upstream)'{-u,--set-upstream}'[add upstream reference for each branch that is up to date or pushed]' \ '( --no-thin)--thin[try to minimize number of objects to be sent]' \ '(--thin )--no-thin[do not try to minimize number of objects to be sent]' \ '(-q --quiet -v --verbose --progress)'{-q,--quiet}'[suppress all output]' \ @@ -1265,7 +1285,20 @@ _git-push () { '--recurse-submodules=[submodule handling]:submodule handling:((check\:"refuse pushing of supermodule if submodule commit cannot be found on the remote" on-demand\:"push all changed submodules"))' \ ':: :__git_any_repositories' \ - '*: :__git_ref_specs' + '*: :__git_ref_specs' && ret=0 + + case $state in + (lease) + compset -P '*:' + if [[ -n ${IPREFIX#*=} ]]; then + _guard '[[:xdigit:]]#' "expected value" && ret=0 + else + __git_remote_branch_names_noprefix && ret=0 + fi + ;; + esac + + return ret } (( $+functions[_git-rebase] )) || @@ -1300,6 +1333,8 @@ _git-rebase () { {-x,--exec}'[with -i\: append "exec <cmd>" after each line]:command' \ '(1)--root[rebase all reachable commits]' \ $autosquash_opts \ + '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \ + '(--autostash --no-autostash)--no-autostash[do not stash uncommitted changes before rebasing and apply them afterwards]' \ '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ '--onto[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ ':upstream branch:__git_revisions' \ @@ -1501,7 +1536,7 @@ _git-stash () { '(--keep-index )--no-keep-index[all changes already added to the index are undone]' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ '(-u --include-untracked)'{-u,--include-untracked}'[include untracked files]' \ - '::message' && ret=0 + ':: :_guard "([^-]?#|)" message' && ret=0 ;; (list) local -a log_options revision_options @@ -1556,7 +1591,7 @@ _git-stash () { _git-status () { local -a branch_opts - if (( $words[(I)-s|--short] )); then + if (( $words[(I)-s|--short|--porcelain|-z] )); then branch_opts=('(-b --branch)'{-b,--branch}'[show branch and tracking info]') fi @@ -1889,13 +1924,13 @@ _git-config () { 'browser.*.cmd:browser command to use:browser:_path_commands' 'browser.*.path:path to use for the browser:absolute browser path:_files -g "*(*)"' clean.requireForce:'require --force for git clean to actually do something::->bool:true' - color.branch:'color output of git branch::->color-bool' + color.branch:'color output of git branch::->color-bool:false' color.branch.current:'color of the current branch::->color' color.branch.local:'color of a local branch::->color' color.branch.remote:'color of a remote branch::->color' color.branch.upstream:'color of upstream branches::->color' color.branch.plain:'color of other branches::->color' - color.diff:'color output of git diff::->color-bool' + color.diff:'color output of git diff::->color-bool:false' color.diff.plain:'color of context text::->color' color.diff.meta:'color of meta-information::->color' color.diff.frag:'color of hunk headers::->color' @@ -1909,7 +1944,7 @@ _git-config () { color.decorate.tag:'color of tags::->color' color.decorate.stash:'color of stashes::->color' color.decorate.HEAD:'color of HEAD::->color' - color.grep:'whether or not to color output of git grep::->color-bool' + color.grep:'whether or not to color output of git grep::->color-bool:false' color.grep.context:'color of non-matching text in context lines::->color' color.grep.filename:'color of filename prefix::->color' color.grep.function:'color of function name lines::->color' @@ -1917,14 +1952,14 @@ _git-config () { color.grep.match:'color of matching text::->color' color.grep.selected:'color of non-matching text in selected lines::->color' color.grep.separator:'color of separators between fields in a line::->color' - color.interactive:'whether or not to color in interactive mode::->color-bool' + color.interactive:'whether or not to color in interactive mode::->color-bool:false' color.interactive.prompt:'color of prompt::->color' color.interactive.header:'color of header::->color' color.interactive.help:'color of help::->color' color.interactive.error:'color of error::->color' color.pager:'feed colored output to pager::->bool:true' - color.showbranch:'color output of git show-branch::->color-bool' - color.status:'color output of git status::->color-bool' + color.showbranch:'color output of git show-branch::->color-bool:false' + color.status:'color output of git status::->color-bool:false' color.status.branch:'color of the current branch::->color' color.status.header:'color of header text::->color' color.status.added:'color of added, but not yet committed, files::->color' @@ -1932,7 +1967,7 @@ _git-config () { color.status.changed:'color of changed, but not yet added in the index, files::->color' color.status.untracked:'color of files not currently being tracked::->color' color.status.nobranch:'color of no-branch warning::->color' - color.ui:'color output of capable git commands::->color-bool' + color.ui:'color output of capable git commands::->color-bool:auto' commit.cleanup:'default --cleanup option::->commit.cleanup:default' commit.status:'include status information in commit message template::->bool:true' commit.template:'template file for commit messages:template:_files' @@ -1949,6 +1984,7 @@ _git-config () { diff.external:'command to generate diff with:diff command:_path_commands' diff.mnemonicprefix:'use mnemonic source and destination prefixes::->bool:false' diff.noprefix:'strip source and destination prefixes::->bool:false' + diff.orderfile:'file to read patch order glob patterns from:order file:_files' diff.renameLimit:'number of files to consider when detecting copy/renames:rename limit:->int' diff.renames:'try to detect renames::->diff.renames:true' diff.ignoreSubmodules:'ignore submodules::->bool:false' @@ -1961,6 +1997,7 @@ _git-config () { difftool.prompt:'prompt before each invocation of the diff tool::->bool:true' diff.wordRegex:'regex used to determine what a word is when performing word-by-word diff:regular expression:->string' diff.guitool:'diff tool with gui to use::__git_difftools' + fetch.prune:'remove any remote tracking branches that no longer exist remotely::->bool:false' fetch.unpackLimit:'maximum number of objects to unpack when fetching:unpack limit:->int' fetch.recurseSubmodules:'recurse into submodules (as needed) when fetching::->fetch.recurseSubmodules:on-demand' fetch.fsckObjects:'check all fetched objects::->bool:false' @@ -2043,13 +2080,14 @@ _git-config () { grep.lineNumber:'enable -n option by default::->bool:false' grep.patternType:'default matching pattern type::->grep.patternType:default' help.browser:'browser used to display help in web format::__git_browsers' - http.cookiefile:'file containing cookie lines which should be used in the Git http session::_files' help.htmlpath:'location of HTML help::->help.htmlpath' + http.cookiefile:'file containing cookie lines which should be used in the Git http session::_files' http.lowSpeedLimit:'limit controlling when to abort an HTTP transfer:speed limit:->int' http.lowSpeedTime:'limit controlling when to abort an HTTP transfer:time limit (seconds):->int' help.format:'default help format used by git help::->help.format' help.autocorrect:'execute corrected mistyped commands::->bool:false' http.proxy:'HTTP proxy to use:proxy:_urls' + http.savecookies:'save cookies to the cookie file::->bool:false' http.sslVerify:'verify the SSL certificate for HTTPS::->bool:true' http.sslCert:'file containing SSL certificates for HTTPS:SSL certificate file:_files' http.sslKey:'file containing the SSL private key for HTTPS:SSL private key file:_files' @@ -2067,6 +2105,30 @@ _git-config () { http.getanyfile:'allow clients to read any file within repository::->bool:true' http.uploadpack:'serve git fetch-pack and git ls-remote clients::->bool:true' http.receivepack:'serve git send-pack clients::->bool:true' + 'http.*.cookiefile:file containing cookie lines which should be used in the Git http session::_files' + 'http.*.lowSpeedLimit:limit controlling when to abort an HTTP transfer:speed limit:->int' + 'http.*.lowSpeedTime:limit controlling when to abort an HTTP transfer:time limit (seconds):->int' + 'help.*.format:default help format used by git help::->help.format' + 'help.*.autocorrect:execute corrected mistyped commands::->bool:false' + 'http.*.proxy:HTTP proxy to use:proxy:_urls' + 'http.*.savecookies:save cookies to the cookie file::->bool:false' + 'http.*.sslVerify:verify the SSL certificate for HTTPS::->bool:true' + 'http.*.sslCert:file containing SSL certificates for HTTPS:SSL certificate file:_files' + 'http.*.sslKey:file containing the SSL private key for HTTPS:SSL private key file:_files' + 'http.*.sslCertPasswordProtected:prompt for a password for the SSL certificate::->bool:false' + 'http.*.sslCAInfo:file containing CA certificates to verify against for HTTPS:CA certificates file:_files' + 'http.*.sslCAPath:directory containing files with CA certificates to verify against for HTTPS:CA certificates directory:_directories' + 'http.*.sslTry:attempt to use AUTH SSL/TLS and encrypted data transfers when connecting via regular FTP protocol::->bool:false' + 'http.*.maxRequests:how many HTTP requests to launch in parallel:maximum number of requests::->int:5' + 'http.*.minSessions:number of curl sessions to keep across requests:minimum number of sessions::->int:1' + 'http.*.postBuffer:maximum size of buffer used by smart HTTP transport when POSTing:maximum POST buffer size:->bytes:1m' + 'http.*.lowSpeedLimit:lower limit for HTTP transfer-speed:low transfer-speed limit:->int' + 'http.*.lowSpeedTime:duration for http.lowSpeedLimit:time:->int' + 'http.*.noEPSV:disable the use of the EPSV ftp-command::->bool:false' + 'http.*.useragent:user agent presented to HTTP server:user agent string:->string' + 'http.*.getanyfile:allow clients to read any file within repository::->bool:true' + 'http.*.uploadpack:serve git fetch-pack and git ls-remote clients::->bool:true' + 'http.*.receivepack:serve git send-pack clients::->bool:true' i18n.commitEncoding:'character encoding commit messages are stored in::->encoding' i18n.logOutputEncoding:'character encoding commit messages are output in::->encoding' imap.folder:'IMAP folder to use with git imap-send:IMAP folder name::_mailboxes' @@ -2131,11 +2193,12 @@ _git-config () { pack.indexVersion:'default pack index version:index version:->string' pack.packSizeLimit:'maximum size of packs:maximum size of packs:->bytes' pull.octopus:'default merge strategy to use when pulling multiple branches::__git_merge_strategies' - pull.rebase:'rebase branches on top of the fetched branch, instead of merging::->bool:false' + pull.rebase:'rebase branches on top of the fetched branch, instead of merging::->pull.rebase:false' pull.twohead:'default merge strategy to use when pulling a single branch::__git_merge_strategies' push.default:'action git push should take if no refspec is given::->push.default:matching' rebase.stat:'show a diffstat of what changed upstream since last rebase::->bool:false' rebase.autosquash:'autosquash by default::->bool:false' + rebase.autostash:'autostash by default::->bool:false' receive.autogc:'run git gc --auto after receiving data::->bool:true' receive.fsckObjects:'check all received objects::->bool:true' receive.hiderefs:'string(s) receive-pack uses to decide which refs to omit from its initial advertisement:hidden refs:->string' @@ -2149,6 +2212,7 @@ _git-config () { 'remote.*.url:URL of a remote repository::__git_any_repositories' 'remote.*.pushurl:push URL of a remote repository::__git_any_repositories' 'remote.*.proxy:URL of proxy to use for a remote repository::_urls' + 'remote.*.prune:remove any remote tracking branches that no longer exist remotely::->bool:false' 'remote.*.fetch:default set of refspecs for git fetch::__git_ref_specs' 'remote.*.push:default set of refspecs for git push::__git_ref_specs' 'remote.*.mirror:push with --mirror::->bool:false' @@ -2184,6 +2248,7 @@ _git-config () { sendemail.smtpserver:'SMTP server to connect to:smtp host:_hosts' sendemail.smtpserveroption:'specifies the outgoing SMTP server option to use:SMTP server option:->string' sendemail.smtpserverport:'port to connect to SMTP server on:smtp port:_ports' + sendemail.smtpsslcertpath:'path to ca-certificates (directory or file):ca certificates path:_files' sendemail.smtpuser:'user to use for SMTP-AUTH:smtp user:_users' sendemail.thread:'set In-Reply-To\: and References\: headers::->bool:true' sendemail.validate:'perform sanity checks on patches::->bool:true' @@ -2223,7 +2288,7 @@ _git-config () { 'submodule.*.fetchRecurseSubmodules:fetch commits of submodules::->bool' 'submodule.*.path:path within project:submodule directory:_directories -qS \:' 'submodule.*.url:URL to update from::__git_any_repositories' - 'submodule.*.update:update strategy to use::->submodule.update' + 'submodule.*.update:update strategy to use::->submodule.update:none' 'submodule.*.ignore:ignore modifications to submodules with git status and git diff-*::->submodule.ignore' svn.noMetadata:'disable git-svn-id: lines at end of commits::->bool:false' svn.useSvmProps:'use remappings of URLs and UUIDs from mirrors::->bool:false' @@ -2301,6 +2366,7 @@ _git-config () { 'gc.*.:${${line[1]#gc.}%.*}-specific gc option' 'gitcvs.*.:gitcvs ${${line[1]#gitcvs.}%.*}-specific option' 'guitool.*.:${${line[1]#guitool.}%.*}-specific option' + 'http.*.:${${line[1]#http.}%.*}-specific option' 'man.*.:${${line[1]#man.}%.*}-specific man option' 'merge.*.:${${line[1]#merge.}%.*}-specific merge option' 'mergetool.*.:${${line[1]#mergetool.}%.*}-specific option' @@ -2358,6 +2424,9 @@ _git-config () { (guitool.) __git_config_sections '^guitool\..+\.[^.]+$' guitools 'gui tool' -S . && ret=0 ;; + (http.) + __git_config_sections '^http\..+\.[^.]+$' bases base -S . && ret=0 + ;; (man.) __git_man_viewers -S . && ret=0 ;; @@ -2568,7 +2637,7 @@ _git-config () { esac ;; (color-bool) - __git_config_values -t booleans -l boolean -- "$current" false \ + __git_config_values -t booleans -l boolean -- "$current" "$parts[5]" \ {never,false,no,off}:"do not $parts[2]" \ always:"always $parts[2]" \ {auto,true,yes,on}:$parts[2] && ret=0 @@ -2749,6 +2818,12 @@ _git-config () { (permission) __git_repository_permissions && ret=0 ;; + (pull.rebase) + __git_config_values -- "$current" "$parts[5]" \ + {true,yes,on}:$parts[2] \ + {false,no,off}:"do not $parts[2]" \ + preserve:"rebase and preserve merges" && ret=0 + ;; (push.default) __git_config_values -- "$current" "$parts[5]" \ nothing:'do not push anything' \ @@ -2802,6 +2877,18 @@ _git-config () { _message "${parts[3]:-${parts[2]:-value}}" fi ;; + (submodule.update) + compset -P '*!' + if [[ -n $IPREFIX ]]; then + _command_names -e + else + __git_config_values -- "$current" "$parts[5]" \ + rebase:'rebase current branch onto commit recorded in superproject' \ + merge:'merge commit recorded in superproject into current branch of submodule' \ + none:'do not merge or rebase' \ + '!:specify command name that takes sha1 to update to as parameter' && ret=0 + fi + ;; (submodule.ignore) __git_config_values -- "$current" "$parts[5]" \ all:'never consider submodules modified' \ @@ -3155,7 +3242,7 @@ _git-blame () { '-b[show blank SHA-1 for boundary commits]' \ '--root[do not treat root commits as boundaries]' \ '--show-stats[include additional statistics at the end of blame output]' \ - '-L[annotate only the given line range]: :->line-range' \ + '*-L[annotate only the given line range]: :->line-range' \ '-l[show long rev]' \ '-t[show raw timestamp]' \ '-S[use revs from revs-file]:revs-file:_files' \ @@ -3353,6 +3440,7 @@ _git-rev-parse () { '(- *)'{-h,--help}'[display usage]' \ '--keep-dashdash[do not skip first -- option]' \ '--stop-at-non-option[stop parsing options at first non-option argument]' \ + '--stuck-long[output options in long form if available, and with their arguments stuck]' \ '*:option specification' && ret=0 fi elif (( words[(I)--sq-quote] )); then @@ -3580,6 +3668,7 @@ _git-send-email () { '--smtp-server=[specify SMTP server to connect to]:smtp server:_hosts' \ '--smtp-server-port=[specify port to connect to SMTP server on]:smtp port:_ports' \ '--smtp-server-option=[specify the outgoing SMTP server option to use]:SMPT server option' \ + '--smtp-ssl-cert-path=[path to ca-certificates (directory or file)]:ca certificates path:_files' \ '--smtp-user=[specify user to use for SMTP-AUTH]:smtp user:_users' \ '--smtp-debug=[enable or disable debug output]:smtp debug:((0\:"disable" 1\:"enable"))' \ '--cc-cmd=[specify command to generate Cc\: header with]:Cc\: command:_path_commands' \ @@ -4166,10 +4255,18 @@ _git-update-index () { (( $+functions[_git-update-ref] )) || _git-update-ref () { + local z_opt + + if (( words[(I)--stdin] )); then + z_opt='-z[values are separated with NUL character when reading from stdin]' + fi + _arguments -w -S -s \ '-m[update reflog for specified name with specified reason]:reason for update' \ '(:)-d[delete given reference after verifying its value]:symbolic reference:__git_revisions:old reference:__git_revisions' \ - '--no-deref[overwrite ref itself, not what it points to]' \ + '(-d --no-deref)--stdin[reads instructions from standard input]' \ + $z_opt \ + '(-d -z --stdin)--no-deref[overwrite ref itself, not what it points to]' \ ':symbolic reference:__git_revisions' \ ':new reference:__git_revisions' \ '::old reference:__git_revisions' @@ -4377,6 +4474,7 @@ _git-merge-base () { '--octopus[compute best common ancestors of all supplied commits]' \ '--is-ancestor[tell if A is ancestor of B (by exit status)]' \ '(-)--independent[display minimal subset of supplied commits with same ancestors]' \ + '--fork-point[find the point at which B forked from ref A (uses reflog)]' \ ': :__git_commits' \ '*: :__git_commits' } @@ -4445,9 +4543,9 @@ _git-show-index () { _git-show-ref () { _arguments -S \ - list \ - '(-h --head)'{-h,--head}'[show HEAD reference]' \ + '(-h --head)'{-h,--head}'[show the HEAD reference, even if it would normally be filtered out]' \ '--tags[show only refs/tags]' \ - '--heads[show only HEAD and refs under refs/heads]' \ + '--heads[show only refs/heads]' \ '(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \ '(-s --hash)'{-s+,--hash=-}'[only show the SHA-1 hash, not the reference name]:: :__git_guard_number length' \ '--verify[enable stricter reference checking]' \ @@ -4686,6 +4784,7 @@ _git-check-attr () { {-a,--all}'[list all attributes that are associated with the specified paths]' \ '--stdin[read file names from stdin instead of from command line]' \ '--cached[consider .gitattributes in the index only, ignoring the working tree.]' \ + '-z[make output format machine-parseable and treat input-paths as NUL-separated with --stdin]' \ $z_opt \ '(-)--[interpret preceding arguments as attributes and following arguments as path names]' \ '*:: :->attribute-or-file' && ret=0 @@ -4798,12 +4897,12 @@ __git_command_successful () { (( $+functions[__git_committish_range_first] )) || __git_committish_range_first () { - print -r -- ${1%..(.|)*} + print -r -- ${${${1%..*}%.}:-HEAD} } (( $+functions[__git_committish_range_last] )) || __git_committish_range_last () { - print -r -- ${1##*..(.|)} + print -r -- ${${${1#*..}#.}:-HEAD} } (( $+functions[__git_pattern_escape] )) || @@ -4832,12 +4931,12 @@ __git_is_treeish () { (( $+functions[__git_is_committish_range] )) || __git_is_committish_range () { - # TODO: This isn't quite right. We would like to do parts=${(~s:..(.|))}, - # but that doesn't work. (This would allow us to make sure that parts only - # contains two elements and then apply __git_is_committish on them. - [[ $1 == *..(.|)* ]] && - __git_is_committish $(__git_committish_range_first $1) && - __git_is_committish $(__git_committish_range_last $1) + [[ $1 == *..(.|)* ]] || return 1 + local first=$(__git_committish_range_first $1) + local last=$(__git_committish_range_last $1) + [[ $first != *..* && $last != *..* ]] && \ + __git_is_committish $first && \ + __git_is_committish $last } (( $+functions[__git_is_initial_commit] )) || @@ -5427,9 +5526,12 @@ __git_remote_branch_names_noprefix () { __git_commits () { # TODO: deal with things that __git_heads and __git_tags has in common (i.e., # if both exists, they need to be completed to heads/x and tags/x. + local -a sopts ropt + zparseopts -E -a sopts S: r:=ropt R: q + sopts+=( $ropt:q ) _alternative \ - 'heads::__git_heads' \ - 'commit-tags::__git_commit_tags' \ + "heads::__git_heads $sopts" \ + "commit-tags::__git_commit_tags $sopts" \ 'commit-objects::__git_commit_objects' } @@ -5496,10 +5598,12 @@ __git_commits2 () { (( $+functions[__git_commit_ranges] )) || __git_commit_ranges () { + local -a suf if compset -P '*..(.|)'; then __git_commits $* else - __git_commits $* -qS .. + compset -S '..*' || suf=( -S .. -r '.@~ ^:\t\n\-' ) + __git_commits $* $suf fi } @@ -5537,7 +5641,7 @@ __git_submodules () { local expl declare -a submodules - submodules=(${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#* }) + submodules=(${${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#?* }%% *}) __git_command_successful $pipestatus || return 1 _wanted submodules expl submodule compadd $* - $submodules @@ -5683,9 +5787,17 @@ __git_files () { # TODO: --directory should probably be added to $opts when --others is given. local pref=$gitcdup$gitprefix$PREFIX + + # First allow ls-files to pattern-match in case of remote repository files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- ${pref:+$pref\\\*} 2>/dev/null)"}) __git_command_successful $pipestatus || return + # If ls-files succeeded but returned nothing, try again with no pattern + if [[ -z "$files" && -n "$pref" ]]; then + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- 2>/dev/null)"}) + __git_command_successful $pipestatus || return + fi + # _wanted $tag expl $description _files -g '{'${(j:,:)files}'}' $compadd_opts - _wanted $tag expl $description _multi_parts -f $compadd_opts - / files } @@ -5957,7 +6069,7 @@ __git_setup_diff_options () { '--find-copies-harder[try harder to find copies]' '(-D --irreversible-delete)'{-D,--irreversible-delete}'[omit the preimage for deletes]' '-l-[limit number of rename/copy targets to run]: :__git_guard_number' - '--diff-filter=-[select certain kinds of files for diff]: :_guard "[ACDMRTUXB*]#" kinds' + '--diff-filter=-[select certain kinds of files for diff]: :_guard "[AaCcDdMmRrTtUuXxBb*]#" kinds' '-S-[look for differences that add or remove the given string]:string' '-G-[look for differences whose added or removed line matches the given regex]:pattern' '--pickaxe-all[when -S finds a change, show all changes in that changeset]' @@ -6052,7 +6164,10 @@ __git_setup_revision_options () { '--tags=[-show all commits from refs/tags]::pattern' '--remotes=[-show all commits from refs/remotes]::pattern' '--glob=[show all commits from refs matching glob]:pattern' - '--stdin[read commit objects from standard input]' + '--exclude=[do not include refs matching glob]:pattern' + '--exclude=[do not include refs matching glob]:pattern' + '--ignore-missing[ignore invalid object an ref names on command line]' + '--bisect[pretend as if refs/bisect/bad --not refs/bisect/good-* was given on command line]' '(-g --walk-reflogs --reverse)'{-g,--walk-reflogs}'[walk reflog entries from most recent to oldest]' '--grep-reflog=[limit commits to ones whose reflog message matches the given pattern (with -g, --walk-reflogs)]:pattern' '--merge[after a failed merge, show refs that touch files having a conflict]' @@ -6262,15 +6377,22 @@ __git_browsers () { builtinbrowsers=( firefox iceweasel + seamonkey + iceape google-chrome + chrome chromium konquerer + opera w3m + elinks links lynx dillo open - start) + start + cygstart + xdg-open) _tags user-browsers builtin-browsers @@ -6469,6 +6591,7 @@ _git() { _arguments -C \ '(- :)--version[display version information]' \ '(- :)--help[display help message]' \ + '-C[run as if git was started in given path]: :_directories' \ '-c[pass configuration parameter to command]:parameter' \ '--exec-path=-[path containing core git-programs]:: :_directories' \ '(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \ diff --git a/Completion/Unix/Command/_gzip b/Completion/Unix/Command/_gzip index a90f23273..927d31d45 100644 --- a/Completion/Unix/Command/_gzip +++ b/Completion/Unix/Command/_gzip @@ -39,6 +39,7 @@ gzip) '(-q --quiet)--silent[suppress all warnings]' \ '(--recursive)-r[operate recursively on directories]' \ '(-r)--recursive[operate recursively on directories]' \ + '--rsyncable[make rsync-friendly archive]' \ '(--suffix)-S+[specify suffix for compressed files]:suffix:' \ '(-S)--suffix=[specify suffix for compressed files]:suffix:' \ '(--test)-t[test compressed file integrity]' \ diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg index f48598278..c18500bcb 100644 --- a/Completion/Unix/Command/_hg +++ b/Completion/Unix/Command/_hg @@ -226,6 +226,16 @@ _hg_modified() { _wanted files expl 'modified files' _multi_parts / status_files } +_hg_committable() { + typeset -a status_files + # A file is a candidate for `hg commit` if it is: + # - modified (m), or + # - added (a), or + # - removed (r) + _hg_status mar + _wanted files expl 'committable files' _multi_parts / status_files +} + _hg_resolve() { local rstate rpath @@ -476,7 +486,7 @@ _hg_cmd_commit() { '(--logfile -l)'{-l+,--logfile}'[read commit message from specified file]:log file:_files' \ '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ - '*:file:_hg_files' + '*:file:_hg_committable' } _hg_cmd_copy() { diff --git a/Completion/Unix/Command/_ip b/Completion/Unix/Command/_ip index 0fc979cd3..f880f2683 100644 --- a/Completion/Unix/Command/_ip +++ b/Completion/Unix/Command/_ip @@ -40,7 +40,7 @@ subcmd_ipaddrs=( ) subcmd_prefix_label=( /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/ - ":ipaddresslabel:IP addrlabel prefix currently set:( $(ip -6 addrlabel list | sed -n 's/^prefix \([0-9a-f\.:/]*\) .*$/\1/p') )" + ":ipaddresslabel:IP addrlabel prefix currently set:( $(ip -6 addrlabel list 2>/dev/null | sed -n 's/^prefix \([0-9a-f\.:/]*\) .*$/\1/p') )" ) diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index d1346f7cc..81ac40bc2 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -29,7 +29,7 @@ _man() { if (( index )); then local opt opt=$words[index+1] - _manpath=($_manpath $opt) + _manpath=($opt) fi # `sman' is the SGML manual directory for Solaris 7. diff --git a/Completion/Unix/Command/_moosic b/Completion/Unix/Command/_moosic new file mode 100644 index 000000000..f22fe16c5 --- /dev/null +++ b/Completion/Unix/Command/_moosic @@ -0,0 +1,487 @@ +#compdef moosic + +_moosic_add_cmds() { + + # querying for information + typeset -a queries + queries=( + "help:print brief description of command" + "current:print name of currently playing song" + "current-time:print the amount of time the current song has been playing" + "list:print the list of items in the current song queue" + "plainlist:print the current song queue without numbering each line" + "history:print a list of items that were recently played" + {status,state}":print the current state of the music daemon" + "length:print the number of items in the queue" + "ispaused:show whether the current song is paused or not" + "islooping:show whether the server is in loop mode" + "isadvancing:show whether the server is advancing through the song queue" + "version:print version information for client and server" + ) + + + # appending to song queue + typeset -a appending + appending=( + {append,add}":add the files to be played to the end of the song queue" + {pl-append,pl-add}":add the items listed in the given playlist files to end of queue" + "prepend:add the files to be played to the beginning of the song queue" + "pl-prepend:add the items in the given playlist files to beginning of queue" + "mixin:add the files to the song queue and reshuffle the entire queue" + "pl-mixin:add items in given playlist files to song queue and reshuffle the entire queue" + "replace:replace the current contents of the song queue with files listed" + "pl-replace:replace current contents of song queue with songs given in playlists" + "insert:insert the given items at a given point in the song queue" + "pl-insert:insert items from playlist files at specified point in queue" + "putback:reinsert current song at start of song queue" + "stagger-add:adds file list to end of queue after rearranging queue into staggered order" + "stagger-merge:adds given file list to queue in interleaved fashion" + "interval-add:inserts given songs with regular frequency specified by interval argument" + ) + + # removing + typeset -a removing + removing=( + {cut,del}":removes all song queue items in given range" + "crop:removes all song queue items that do not fall within given range" + "remove:remove all song queue items matching any one of given regexps" + "filter:remove all queue items not matching all given regexps" + "clear:clear song queue" + "wipe:clear song queue and stop current song" + ) + + # rearranging + typeset -a rearranging + rearranging=( + "move:move all items in given range to new position in song queue" + "move-pattern:moves all items matching the given regexp to new position" + "swap:trade places of songs in two specified ranges" + {shuffle,reshuffle}":reshuffle song queue within an optional range" + "sort:sort queue within optional range" + "reverse:reverse order of song queue" + "partial-sort:sort items matching each regexp" + "stagger:stagger items matching each regexp" + "sub:perform regular expression substitution on all items in queue" + "suball:like sub, but replace all occurrences of the pattern" + ) + + # general management + typeset -a general + general=( + "next:jumps ahead, number of songs optional" + "previous:retreats to previously played song" + "goto:jumps to next song matching regexp" + "gobackto:jumps back to most recent previous song matching regexp" + "noadvance:halt queue advancement" + "advance:resume queue advancement" + "toggle-advance:toggle queue advancement" + "stop:stop playing current song, stop processing queue, put current song back" + "pause:suspend current song to resume it later" + "unpause:unpause current song" + "play:resume playing" + "loop:turn loop mode on" + "noloop:turn loop mode off" + "toggle-loop:toggle loop mode" + "reconfigure:daemon reload configuration file" + "showconfig:show dameon filetype associations" + "start-server:starts new instance of daemon with given options" + {quit,exit,die}":quit daemon" + ) + + _describe queries queries -J queries + _describe appending appending -J appending + _describe removing removing -J removing + _describe rearranging rearranging -J rearranging + _describe general general -J general +} + +_moosic() { + typeset context state line + typeset -A opt_args + + typeset -a filelist_opts + filelist_opts=( + '(-g --shuffle-global)'{-g,--shuffle-global}'[shuffle filelist after directory expansion]' + '(-d --shuffle-dir)'{-d,--shuffle-dir}'[shuffle results of expanding the directories]' + '(-a --shuffle-args)'{-a,--shuffle-args}'[shuffle actual command line arguments]' + '(-o --inorder)'{-o,--inorder}'[do not shuffle filelist]' + '(-s --sort)'{-s,--sort}'[sort filelist lexicographically after expansion]' + '(-r --no-recurse)'{-r,--no-recurse}'[do not recurse through directories]' + '(-n --no-file-munge)'{-n,--no-file-munge}'[do not modify names in expanded filelist]' + '(-f --auto-find)'{-f,--auto-find}'[perform fuzzy search for music files]' + '(-F --auto-grep)'{-F,--auto-grep}'[like --auto-find but with regexp]' + '(-U --allow-unplayable)'{-U,--allow-unplayable}'[allow addition of unknown song types]' + ) + + typeset -a auto_opts + auto_opts=( + '(-m --music-dir)'{-m,--music-dir}'[directory used for auto-find, auto-grep]:directory:_files' + ) + + typeset -a main_opts + main_opts=( + '(-i --ignore-case)'{-i,--ignore-case}'[treat regexps as if they are case-insensitive]' + '(-S --showcommands)'{-S,--showcommands}'[show all moosic commands, then exit]' + '(-h --help)'{-h,--help}'[print help message then exit]' + '(-v --version)'{-v,--version}'[print version information, then exit]' + '(-c --config-dir)'{-c,--config-dir}'[configuration directory]:directory:_files' + '(-t --tcp)'{-t,--tcp}'[talk to server at specified host and port]:host\:port:' + '(-N --no-startserver)'{-N,--no-startserver}'[do not start moosicd server]' + ) + + typeset -a list_opts + list_opts=( + '(-C --current-in-list)'{-C,--current-in-list}'[print currently playing song in list]' + ) + + # GLOBAL ARGUMENTS + # do not use the -A option here. It will break the processing of + # positional arguments. + _arguments $main_opts $list_opts $auto_opts $filelist_opts \ + '1: :->cmd' \ + '*:: :->posarg' + + if [[ $state == cmd ]]; then + _moosic_add_cmds + elif [[ $state == posarg ]]; then + _moosic_cmd_${line[1]} + fi +} + +# Do something, but only if the current word is 2. +_do2() { + if (( CURRENT == 2 )); then + $@ + else + _message 'no more arguments' + fi +} + +### QUERY COMMANDS + +_moosic_cmd_help() { + _do2 '_moosic_add_cmds' +} + +_moosic_cmd_current() { + _message 'no arguments' +} + +_moosic_cmd_current-time() { + _do2 '_message' 'strftime string' +} + +_moosic_cmd_list() { + _do2 '_message' 'range' +} + +_moosic_cmd_plainlist() { + _do2 '_message' 'range' +} + +_moosic_cmd_history() { + _do2 '_message' 'maximum number of entries' +} + +_moosic_cmd_status() { + _message 'no arguments' +} + +_moosic_cmd_state() { + _message 'no arguments' +} + +_moosic_cmd_length() { + _message 'no arguments' +} + +_moosic_cmd_ispaused() { + _message 'no arguments' +} + +_moosic_cmd_islooping() { + _message 'no arguments' +} + +_moosic_cmd_isadvancing() { + _message 'no arguments' +} + +_moosic_cmd_version() { + _message 'no arguments' +} + +### APPENDING COMMANDS + +_moosic_song_files() +{ + _arguments -A '-*' $main_opts $filelist_opts $auto_opts \ + '*:song files:_files' +} + +_moosic_cmd_append() { + _moosic_song_files +} + +_moosic_cmd_add() { + _moosic_song_files +} + +_moosic_cmd_pl-append() { + _moosic_song_files +} + +_moosic_cmd_pl-add() { + _moosic_song_files +} + +_moosic_cmd_prepend() { + _moosic_song_files +} + +_moosic_cmd_pl-prepend() { + _moosic_song_files +} + +_moosic_cmd_mixin() { + _moosic_song_files +} + +_moosic_cmd_pl-mixin() { + _moosic_song_files +} + +_moosic_cmd_replace() { + _moosic_song_files +} + +_moosic_cmd_pl-replace() { + _moosic_song_files +} + +_moosic_cmd_insert() { + _moosic_song_files +} + +_moosic_cmd_pl-insert() { + _moosic_song_files +} + +_moosic_cmd_putback() { + _message 'no arguments' +} + +_moosic_cmd_stagger-add() { + _moosic_song_files +} + +_moosic_cmd_stagger-merge() { + _moosic_song_files +} + +_moosic_cmd_interval-add() { + _arguments -A '-*' $main_opts $filelist_opts \ + '1:interval:' \ + '*:song files:_files' +} + +### REMOVING COMMANDS + +_moosic_cmd_cut() { + _do2 '_message' 'range' +} + +_moosic_cmd_del() { + _do2 '_message' 'range' +} + +_moosic_cmd_crop() { + _do2 '_message' 'range' +} + +_moosic_cmd_remove() { + _do2 '_message' 'regex' +} + +_moosic_cmd_filter() { + _do2 '_message' 'regex' +} + +_moosic_cmd_clear() { + _message 'no arguments' +} + +_moosic_cmd_wipe() { + _message 'no arguments' +} + +### REARRANGING COMMANDS + +_moosic_cmd_move() { + _arguments -A '-*' $main_opts \ + '1:range:' \ + '2:index:' \ + '*:no more arguments:' +} + +_moosic_cmd_move-pattern() { + _arguments -A '-*' $main_opts \ + '1:regex:' \ + '2:index:' \ + '*:no more arguments:' +} + +_moosic_cmd_swap() { + _arguments -A '-*' $main_opts \ + '1:range:' \ + '2:range:' \ + '*:no more arguments:' +} + +_moosic_cmd_shuffle() { + _arguments -A '-*' $main_opts \ + '1:range (optional):' \ + '*:no more arguments:' +} + +_moosic_cmd_reshuffle() { + _arguments -A '-*' $main_opts \ + '1:range (optional):' \ + '*:no more arguments:' +} + +_moosic_cmd_sort() { + _arguments -A '-*' $main_opts \ + '1:range (optional):' \ + '*:no more arguments:' +} + +_moosic_cmd_reverse() { + _arguments -A '-*' $main_opts \ + '1:range (optional):' \ + '*:no more arguments:' +} + +_moosic_cmd_partial-sort() { + _do2 '_message' 'regex' +} + +_moosic_cmd_stagger() { + _do2 '_message' 'regex' +} + +_moosic_cmd_sub() { + _arguments -A '-*' $main_opts \ + '1:pattern:' \ + '2:replacement:' \ + '3:range (optional):' \ + '*:no more arguments:' +} + +_moosic_cmd_suball() { + _arguments -A '-*' $main_opts \ + '1:pattern:' \ + '2:replacement:' \ + '3:range (optional):' \ + '*:no more arguments:' +} + +### GENERAL COMMANDS + +_moosic_cmd_next() { + if (( CURRENT == 2 )); then + + typeset -a display display_cmd + if zstyle -a ":completion:${curcontext}:next" \ + 'command' display_cmd; then + $display_cmd + else + display=(${(f)"$(moosic list)"}) + fi + + typeset -a numbers + numbers=({1..${#display}}) + + compadd -V songs -d display -a numbers + else + _message 'no more arguments' + fi +} + +_moosic_cmd_previous() { + _do2 '_message' 'number to skip' +} + +_moosic_cmd_goto() { + _do2 '_message' 'regex' +} + +_moosic_cmd_gobackto() { + _do2 '_message' 'regex' +} + +_moosic_cmd_noadvance() { + _message 'no arguments' +} + +_moosic_cmd_advance() { + _message 'no arguments' +} + +_moosic_cmd_toggle-advance() { + _message 'no arguments' +} + +_moosic_cmd_stop() { + _message 'no arguments' +} + +_moosic_cmd_pause() { + _message 'no arguments' +} + +_moosic_cmd_unpause() { + _message 'no arguments' +} + +_moosic_cmd_play() { + _message 'no arguments' +} + +_moosic_cmd_loop() { + _message 'no arguments' +} + +_moosic_cmd_noloop() { + _message 'no arguments' +} + +_moosic_cmd_toggle-loop() { + _message 'no arguments' +} + +_moosic_cmd_reconfigure() { + _message 'no arguments' +} + +_moosic_cmd_showconfig() { + _message 'no arguments' +} + +_moosic_cmd_start-server() { + _message 'options' +} + +_moosic_cmd_quit() { + _message 'no arguments' +} + +_moosic_cmd_exit() { + _message 'no arguments' +} + +_moosic_cmd_die() { + _message 'no arguments' +} + +_moosic "$@" diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc index 1ff9ad950..12707677f 100644 --- a/Completion/Unix/Command/_mpc +++ b/Completion/Unix/Command/_mpc @@ -25,7 +25,7 @@ _mpc_command() { local mpc_cmds mpc_cmds=( - add:"add a song to the current playlist" + add:"append a song to the end of the current playlist" clear:"clear the current playlist" crop:"remove all songs except for the currently playing song" current:"show the currently playing song" @@ -35,6 +35,7 @@ _mpc_command() { enable:"enable a output" idle:"wait until an event occurs" idleloop:"loop waiting for events" + insert:"insert a song after the currently playing song in the playlist" listall:"list all songs in the music directory" load:"load file as a playlist" ls:"list the contents of specified directory" @@ -253,7 +254,7 @@ _mpc_search() { local list expl list=(album artist title track name genre date composer performer comment disc filename any) - if [[ $#words -eq 2 ]]; then + if ! (( $#words % 2 )); then _wanted list expl table compadd $expl -a list else _message "pattern" diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index 5638014d6..3ceb8c932 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -21,7 +21,7 @@ case $state in _alternative \ "object-files:object file:_path_files -g '*.o'" \ "executable-files:executable file:_path_files -g '*(*)'" \ - "dynamic-libraries:dynamic library:_path_files -g '*.so'" \ + "dynamic-libraries:dynamic library:_path_files -g '*.so(.*)#'" \ "static-libraries:static library:_path_files -g '*.a'" \ "directories:directory:_path_files -g '*(/)'" && ret=0 ;; diff --git a/Completion/Unix/Command/_npm b/Completion/Unix/Command/_npm index 24b536188..f5493a321 100644 --- a/Completion/Unix/Command/_npm +++ b/Completion/Unix/Command/_npm @@ -1,19 +1,9 @@ #compdef npm -# Node Package Manager 0.3.15 completion, letting npm do all the completion work +# Node Package Manager completion, letting npm do all the completion work -_npm() { - compadd -- $(_npm_complete $words) -} +if type npm > /dev/null; then + eval "$(npm completion)" -# We want to show all errors of any substance, but never the "npm (not )ok" one. -# (Also doesn't consider "ERR! no match found" worth breaking the terminal for.) -_npm_complete() { - local ask_npm - ask_npm=(npm completion --color false --loglevel error -- $@) - { _call_program npm $ask_npm 2>&1 >&3 \ - | egrep -v '^(npm (not |)ok|ERR! no match found)$' >&2; \ - } 3>&1 -} - -_npm "$@" + _npm_completion "$@" +fi diff --git a/Completion/Unix/Command/_od b/Completion/Unix/Command/_od new file mode 100644 index 000000000..d542597e0 --- /dev/null +++ b/Completion/Unix/Command/_od @@ -0,0 +1,71 @@ +#compdef od + +local context state state_descr line args ret=1 +local -A opt_args + +args=( + '(-A --address-radix)'{-A+,--address-radix=}'[file offset base]:base:((d\:decimal o\:octal x\:hexadecimal n\:none))' + '(-j --skip-bytes)'{-j+,--skip-bytes=}'[skip specified bytes]:bytes' + '(-N --read-bytes)'{-N+,--read-bytes=}'[dump at most specified bytes]:bytes' + '*'{-t+,--format=}'[specify output format]:format string:->format' + '(-v --output-duplicates)'{-v,--output-duplicates}'[do not use * to mark line suppression]' + '-a[output named characters (-t a)]' + '-b[output octal bytes (-t o1)]' + '-c[output characters with C-style escape (-t c)]' + '-d[output unsigned decimal shorts (-t u2)]' + '-f[output single-precision floats (-t fF)]' + {-h,-x}'[output hexadecimal shorts (-t x2)]' + '-i[output decimal integers (-t dI)]' + {-l,-I,-L}'[output decimal longs (-t dL)]' + {-o,-B}'[output octal shorts (-t o2)]' + '-s[output decimal shorts (-t d2)]' + '*:files:_files' +) + +if _pick_variant gnu=GNU unix --version; then + # -h -B -I and -L are obsolescent and undocumented + args=( ${(R)args:#(|\*)(|\(*\))-[hBIL]*} ) + args+=( + {-S+,--strings=-}'[output strings of at least specfied bytes long]:length' + {-w-,--width=-}'[output specified bytes per line]:bytes' + '(- : *)--help[display help and exit]' + '(- : *)--version[output version information and exit]' + ) +else + args=( ${(R)args:#(|\*)(|\(*\))--*} ) # remove long options + case "$OSTYPE" in + (darwin*|freebsd*|dragonfly*|openbsd*) + args+=( + '-D[output unsigned decimal ints (-t u4)]' + {-e,-F}'[output double-precision floats (-t fD)]' + {-H,-X}'[output hexadecimal ints (-t x4)]' + '-O[output octal ints (-t o4)]' + ) + ;; + (*) + # POSIX options only + args=( ${(M)args:#(|\*)(|\(*\))-[AjNtvbcdosx]*} ) + ;; + esac +fi + +_arguments -s -S : "$args[@]" && return 0 + +case "$state" in + (format) + compset -P '*[acCSIL1248FDL]' + if compset -P '*[doux]'; then + args=( 'C:char' 'S:short' 'I:int' 'L:long' 1 2 4 8 ) + _describe -t integer-size 'size of integer' args && ret=0 + elif compset -P '*f'; then + args=( 'F:float' 'D:double' 'L:long double' ) + _describe -t float-size 'size of float' args && ret=0 + fi + args=( 'a:named character' 'c:character (C-style escape)' + 'd:decimal' 'o:octal' 'u:unsigned decimal' + 'x:hexadecimal' 'f:floating-point number' ) + _describe -t type-specifier 'type specifier' args && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index bcfe5229a..839870211 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -1203,9 +1203,11 @@ _perforce_files() { # probably ought to be optional (you can do it with tags if # you really want). if [[ $PREFIX = //[^/]# && $whole_path -eq 0 ]]; then - # Complete //clientname spec. Don't complete non-directories... + # Complete //clientname or //depot spec. + # Don't complete non-directories... # I don't actually know if they are valid here. - altfiles+=("clients:Perforce client:_perforce_clients") + altfiles+=("clients:Perforce client:_perforce_clients" + "depots:Perforce depot:_perforce_depots") else local donefiles=1 if [[ -z $dodirs ]]; then diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl index b00baa6ed..52559b800 100644 --- a/Completion/Unix/Command/_perl +++ b/Completion/Unix/Command/_perl @@ -4,6 +4,7 @@ # Adam Spiers <adam@spiers.net> # # Completions currently based on Perl 5.14.1. +typeset -A opt_args _perl () { _arguments -s \ @@ -16,8 +17,8 @@ _perl () { '(-d -dt -dt:)-d\:-[run under control of a debugging/tracing module]:debugging/tracing module:_perl_modules --strip-prefix --perl-hierarchy=Devel' \ '(-d -dt -d: )-dt\:-[run under control of a debugging/tracing module (debugged coded uses threads)]:debugging/tracing module:_perl_modules --strip-prefix --perl-hierarchy=Devel' \ '-D-[set debugging flags]: :_perl_debugging_flags' \ - '( -E)*-e+[run one line of program]:one line of program' \ - '(-e )*-E+[like -e but enable all optional features]:one line of program: ' \ + '(1 -E)*-e+[run one line of program]:one line of program' \ + '(1 -e)*-E+[like -e but enable all optional features]:one line of program' \ '-f[disable executing $Config{sitelib}/sitecustomize.pl at startup]' \ '-F-[split() pattern for autosplit (-a)]:split() pattern, // is optional' \ '-h[list help summary]' \ @@ -27,21 +28,29 @@ _perl () { \*{-m,-M}"-[module.. executes \`use/no module...' before executing your script]:module:_perl_m_opt" \ "-n[assume 'while (<>) { ... }' loop around your script]" \ "-p[assume loop like -n but print line also like sed]" \ - '-P[run script through C preprocessor before compilation (deprecated)]' \ "-s[enable some switch parsing for switches after script name]" \ "-S[look for the script using PATH environment variable]" \ '( -T)-t[turn on taint checks but only issue warnings]' \ '(-t )-T[turn on taint checks]' \ "-u[dump core after parsing script]" \ "-U[allow unsafe operations]" \ - "-v[print version number, patchlevel plus VERY IMPORTANT perl info]" \ + "-v[print version, patchlevel and license]" \ "-V-[print perl configuration information]:configuration keys:_perl_config_vars" \ '( -W -X)-w[turn warnings on for compilation of your script (recommended)]' \ "(-w -X)-W[enable all warnings (ignores 'no warnings')]" \ "(-w -W )-X[disable all warnings (ignores 'use warnings')]" \ - '-x-[strip off text before #!perl line and perhaps cd to directory]:directory to cd to:_files -/' \ - '1:Perl script:_files -/ -g "*.(p[ml]|PL|t)(-.)"' \ - '*::args: _normal' + '-x-[ignore text before #!perl line and optionally cd to directory]:directory to cd to:_files -/' \ + '1:Perl script:_files -g "*.(p[ml]|PL|t)(-.)"' \ + '*::args:= _perl_normal' +} + +_perl_normal() { + local expl + if [[ -z "$opt_args[(I)-(e|E)]" ]]; then + shift words + (( CURRENT-- )) + fi + _normal && ret=0 } _perl_m_opt () { diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index e460202a1..3b180ab2d 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -1,32 +1,71 @@ -#compdef pgrep pkill +#compdef pgrep pkill local context state line ret=1 expl typeset -A opt_args typeset -a arguments -arguments=('-P[parent process id]:parent process id:->ppid' - '-g[match only in process group ids]:group:->pgid' - '-G[match only real group id]:group:_groups' - '-s[match only session id]:session id:->sid' +arguments=('-P[parent process id]:parent process id:->ppid' + '-F[match only in process in pidfile]:files:_files' + '-g[match only in process group ids]:group:->pgid' + '-G[match only real group id]:group:_groups' + '-j[match only in processes inside jails]:jail id:->jid' + '-J[match only in project ids]:project id:->projid' + '-M[extract the name list from the specified core]:files:_files' + '-N[extract the name list from the specified system]:files:_files' + '-s[match only session id]:session id:->sid' '-t[match only controlled by terminal]:terminal device:->tty' - '-u[match only effective user id]:user:_users' - '-U[match only real user id]:user:_users' - '(-n)-o[oldest process]' - '(-o)-n[newest process]' - '-f[match against full command line]' - '-v[negate matching]' - '-x[match exactly]' - '*:process name:->pname') + '-T[match only in processes specified routing table in rtable]' + '-u[match only effective user id]:user:_users' + '-U[match only real user id]:user:_users' + '(-n)-o[oldest process]' + '(-o)-n[newest process]' + '-a[include process ancestors in the match list]' + '-c[print a count of matching processes]' + '-f[match against full command line]' + '-i[ignore case distinctions]' + '-I[confirmation before attempting to single each process]' + '-L[given pidfile must be locked]' + '-q[do not write anything to standard output]' + '-S[search also in system processes]' + '-v[negate matching]' + '-x[match exactly]' + '-z[match only in zones]:zone:_zones') -if [[ $service == 'pkill' ]] -then +if [[ $service == 'pkill' ]]; then arguments+=('-'${^signals}'[signal]') -elif [[ $service == 'pgrep' ]] -then +elif [[ $service == 'pgrep' ]]; then arguments+=('-d[output delimiter]:delimiter:compadd ${(s\:\:)IFS}' '-l[list name in addition to id]') fi +local optchars +case "$OSTYPE" in + linux*) + optchars="cflvxdnoPgsuUGt" + ;; + freebsd*) + optchars="LSafilnoqvxFGMNPUdgjstu" + ;; + openbsd*) + optchars="flnoqvxdGgPsTtUu" + ;; + darwin*) + optchars="LafilnoqvxFGPUdgtu" + ;; + solaris*) + optchars="flvxdnoPgsuUGJtTcz" + arguments=( ${arguments##-T*} ) + arguments=( ${arguments##-c*} ) + arguments+=( '-T[match only processes in task ids]:taskid:->task' ) + arguments+=( '-c[match only processes in contract ids]:taskid:->contract' ) + ;; + *) + optchars="flvxdnoPgsuUGt" + ;; +esac +arguments=( ${(M)arguments:#(|\*)(|\(*\))-[$optchars]*} + '*:process name:->pname') + _arguments -s -w $arguments && ret=0 case $state in @@ -39,23 +78,45 @@ case $state in ttys=( /dev/tty*(N) /dev/pts/*(N) ) _wanted tty expl 'terminal device' compadd -S ',' -q -F used ${ttys#/dev/} ;; - + (sid) + if [[ $OSTYPE == openbsd* ]]; then + break + fi + compset -P '*,' local -a used sid used=(${(s:,:)IPREFIX}) - sid=(${(uon)$(ps -A o sid=)}) + if [[ $OSTYPE == freebsd* ]]; then + sid=(${(uon)$(ps -ax -o sid=)}) + else + sid=(${(uon)$(ps -A -o sid=)}) + fi _wanted sid expl 'session id' compadd -S ',' -q -F used $sid ;; - + + (jid) + compset -P '*,' + + local -a used jid + used=(${(s:,:)IPREFIX}) + jid=(${(uon)$(ps -ax -o jid=)}) + + _wanted jid expl 'jail id' compadd -S ',' -q -F used $jid + ;; + (ppid) compset -P '*,' local -a used ppid used=(${(s:,:)IPREFIX}) - ppid=(${(uon)$(ps -A o ppid=)}) + if [[ $OSTYPE == (freebsd|openbsd|darwin)* ]]; then + ppid=(${(uon)$(ps -ax -o ppid=)}) + else + ppid=(${(uon)$(ps -A -o ppid=)}) + fi _wanted ppid expl 'parent process id' compadd -S ',' -q -F used $ppid ;; @@ -65,25 +126,77 @@ case $state in local -a used pgid used=(${(s:,:)IPREFIX}) - pgid=(${(uon)$(ps -A o pgid=)}) + if [[ $OSTYPE == (freebsd|openbsd|darwin)* ]]; then + pgid=(${(uon)$(ps -ax -o pgid=)}) + else + pgid=(${(uon)$(ps -A -o pgid=)}) + fi _wanted pgid expl 'process group id' compadd -S ',' -q -F used $pgid ;; - + + (projid) + compset -P '*,' + + local -a used projid + used=(${(s:,:)IPREFIX}) + projid=(${(uon)$(ps -A -o project=)}) + + _wanted projid expl 'project id' compadd -S ',' -q -F used $projid + ;; + + (contract) + compset -P '*,' + + local -a used ctid + used=(${(s:,:)IPREFIX}) + ctid=(${(uon)$(ps -A -o ctid=)}) + + _wanted ctid expl 'contract id' compadd -S ',' -q -F used $ctid + ;; + + (task) + compset -P '*,' + + local -a used taskid + used=(${(s:,:)IPREFIX}) + taskid=(${(uon)$(ps -A -o project=)}) + + _wanted taskid expl 'task id' compadd -S ',' -q -F used $taskid + ;; + (pname) local ispat="pattern matching " - if (( ${+opt_args[-x]} )) - then + if (( ${+opt_args[-x]} )); then ispat="" fi - if (( ${+opt_args[-f]} )) - then - _wanted pname expl $ispat'process command line' compadd ${(u)${(f)"$(ps -A o cmd=)"}} + + local command + if (( ${+opt_args[-f]} )); then + if [[ "$OSTYPE" == freebsd* ]] && (( ${+opt_args[-S]} )); then + command="$(ps -axH -o command=)" + elif [[ "$OSTYPE" == (freebsd|openbsd|darwin)* ]]; then + command="$(ps -ax -o command=)" + elif [[ "$OSTYPE" == solaris* ]]; then + command="$(ps -A -o args=)" + else + command="$(ps -A o cmd=)" + fi + _wanted pname expl $ispat'process command line' compadd ${(u)${(f)${command}}} else - _wanted pname expl $ispat'process name' compadd ${(u)${(f)"$(ps -A co cmd=)"}} + if [[ "$OSTYPE" == freebsd* ]] && (( ${+opt_args[-S]} )); then + command="$(ps -axcH -o command=)" + elif [[ "$OSTYPE" == (freebsd|openbsd|darwin)* ]]; then + command="$(ps -axc -o command=)" + elif [[ "$OSTYPE" == solaris* ]]; then + command="$(ps -A -o comm=)" + else + command="$(ps -A co cmd=)" + fi + _wanted pname expl $ispat'process name' compadd ${(u)${(f)${command}}} fi ;; - + esac && ret=0 return ret diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php index bbb6a667b..5d7b84e28 100644 --- a/Completion/Unix/Command/_php +++ b/Completion/Unix/Command/_php @@ -7,7 +7,10 @@ local curcontext="$curcontext" line state expl typeset -A opt_args local -a args -local exclusions php_files=':PHP file:_files -g "*.php(-.)"' +local exclusions php_suffix + +zstyle -s ":completion:$curcontext" suffixes php_suffix '|' || php_suffix='php|phar' +local php_files=":PHP file:_files -g '*.($php_suffix)(-.)'" if _pick_variant php5=PHP\ 5 php4 --version; then exclusions="-B --process-begin -R --process-code -F --process-file -E --process-end" diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python index ca1ed37fd..8e32bdf55 100644 --- a/Completion/Unix/Command/_python +++ b/Completion/Unix/Command/_python @@ -1,7 +1,7 @@ -#compdef python +#compdef python python2 python2.4 python2.5 python2.6 python2.7 python3.0 python3.1 python3.2 python3.3 python3.4 -# Python 2.6 -# Python 3.0 +# Python 2.7 +# Python 3.4 local curcontext="$curcontext" state line expl typeset -A opt_args @@ -12,9 +12,12 @@ if _pick_variant python3=Python\ 3 python2 --version; then args=( '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' + "-I[isolate Python from the user's environment]" + '-X[set implementation-specific option]:option' ) else args=( + '-R[use a pseudo-random salt to make hash values unpredeictable]' '-Q+[division options]:division option:(old warn warnall new)' '(-tt)-t[issue warnings about inconsistent tab usage]' '(-t)-tt[issue errors about inconsistent tab usage]' @@ -24,12 +27,12 @@ fi _arguments -C -s -S "$args[@]" \ "-B[don't write .py\[co\] files on import]" \ - '(1 -)-c+[program passed in as string (terminates option list)]:python command:' \ + '(1 -)-c+[program passed in as string (terminates option list)]:python command' \ '-d[debug output from parser]' \ '-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \ '(1 * -)-h[display help information]' \ '-i[inspect interactively after running script]' \ - '(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \ + '(1 -)-m[run library module as a script (terminates option list)]:module:->modules' \ '-O[optimize generated bytecode slightly]' \ '-OO[remove doc-strings in addition to the -O optimizations]' \ "-s[don't add user site directory to sys.path]" \ @@ -39,16 +42,25 @@ _arguments -C -s -S "$args[@]" \ '(1 * -)-V[display version information]' \ '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \ '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \ - '(-)1:script file:_files -g "*.py(|c|o)(-.)"' \ - '*::script argument: _normal' && return + '(-)1:Python script:_files -g "*.py(|c|o)(-.)"' \ + '*::script argument:= ->normal' && return -if [[ "$state" = modules ]]; then - local -a modules - modules=( - ${${=${(f)"$(_call_program modules $words[1] -c \ - 'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)} - ) - _wanted modules expl module compadd -a modules && return -fi +case "$state" in + modules) + local -a modules + modules=( + ${${=${(f)"$(_call_program modules $words[1] -c \ + 'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)} + ) + _wanted modules expl module compadd -a modules && return + ;; + normal) + if [[ -z "$opt_args[(I)-(c|m)]" ]]; then + shift words + (( CURRENT-- )) + fi + _normal && return + ;; +esac return 1 diff --git a/Completion/Unix/Command/_qemu b/Completion/Unix/Command/_qemu index 8ba7140a1..db07eba33 100644 --- a/Completion/Unix/Command/_qemu +++ b/Completion/Unix/Command/_qemu @@ -47,7 +47,7 @@ _arguments \ '-S[do not start CPU at startup]' \ '-d[output log in /tmp/qemu.log]:log items:_qemu_log_items' \ '-hdachs[force hard disk 0 geometry (usually qemu can guess it)]:hd0 geometry c,h,s:' \ - '-std-vga[simulate standard VGA]' \ + '-vga[select video card type]:card type:(std cirrus vmware qxl xenfb none)' \ '-no-acpi[disable ACPI]' \ '-loadvm[start right away with a saved state]:file:_files' \ '-g[set initial graphic mode]:graphic mode:' \ diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index 20f44afc5..1f156c481 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -32,13 +32,9 @@ _arguments -C $opts \ case $state in (file) - declare -a ignored - ignored=() - ((CURRENT > 1)) && - ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) - ((CURRENT < $#line)) && - ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) - _files -F ignored && ret=0 + line[CURRENT]=() + line=( ${line//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} ) + _files -F line && ret=0 ;; esac diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby index 03f4e60c7..946ebe270 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -1,43 +1,78 @@ -#compdef ruby -P -value-,RUBY(LIB|OPT|PATH),-default- +#compdef ruby irb erb -P (ruby|[ei]rb)[0-9.]# -value-,RUBY(LIB|OPT|PATH),-default- -# ruby 1.8.2 (2004-12-25) [i686-linux] - -local curcontext="$curcontext" state line expl ret=1 +local curcontext="$curcontext" state line expl desc RUBY ret=1 typeset -A opt_args +local -a opts irb all common charsets suf -local -a args opts +all=( + '*-r+[require the library before executing your script]:library name:->library' + '(--internal-encoding)-U[set internal encoding to UTF-8]' + '(-E --encoding -K --external-encoding)'{-E+,--encoding=}'[specify default external and internal character encodings]:charset:->charsets' + '(1 * -)'{-h,--help}'[print help message]' + '(1 * -)--version[print the version]' +) -args=( - '(-)1:script file:_files' - '*::script argument: _normal' +common=( + '*-I+[specify $LOAD_PATH directory (may be used more than once)]:library directory:_files -/' + '-w[turn warnings on for your script]' + '-W-[set warning level]:warning level:((0\:silent 1\:medium 2\:verbose))' + '(-)1:ruby script:_files -g "*.rb(-.)"' + '*::script argument:= ->normal' ) opts=( - '-0-[specify record separator]:input record separator in octal (default \0):' + '-0-[specify record separator]:input record separator in octal [default \0]' '-a[autosplit mode with -n or -p (splits $_ into $F)]' '-c[check syntax only]' - '-C+[cd to directory, before executing your script]:directory:_files -/' + '-C+[cd to directory before executing your script]:directory:_files -/' '(-d --debug)'{-d,--debug}'[set debugging flags (set $DEBUG to true)]' - "(1)*-e+[one line of script (several -e's allowed, omit program file)]:one line of script:" + "(1)*-e+[one line script (several -e's allowed, omit program file)]:one line of script" '-F-[split() pattern for autosplit (-a)]:input field separator:' '-i-[edit ARGV files in place (make backup if extension supplied)]:suffix for in-place-edit mode:(.bak)' - '*-I+[specify $LOAD_PATH directory (may be used more than once)]:library directory:_files -/' '-K-[specifies KANJI (Japanese) code-set]:KANJI encoding:((e\:EUC-JP s\:Shift_JIS u\:UTF-8 N\:None))' "-l[assume 'while gets(); ... end' loop around your script]" "(-p)-n[assume 'while gets(); ... end' loop around your script]" '(-n)-p[assume loop like -n but print line also like sed]' - '*-r+[require the library, before executing your script]:library name:->library' '-s[enable some switch parsing for switches after script name]' '-S[look for the script using PATH environment variable]' - '-T-[turn on tainting checks]:taint level (default 0):((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))' + '-T-[turn on tainting checks]:taint level:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))' '(-v --verbose)'{-v,--verbose}'[print version number, then turn on verbose mode]' - '-w[turn warnings on for your script]' - '-W-[set warning level]:warning level (default 2):((0\:silent 1\:medium 2\:verbose))' - '(-y --yydebug)'{-y,--yydebug}'[enable yacc debugging in the parser]' '-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/' '(1 * -)--copyright[print the copyright]' - '(1 * -)'{-h,--help}'[print help message]' - '(1 * -)--version[print the version]' + --{en,dis}able-{gems,rubyopt,all} + --{external,internal}'-encoding=:charset:->charsets' + '!'{-y,--yydebug} + '!--dump=:target:(version copyright usage yydebug syntax parsetree parsetree_with_comment insns)' +) + +irb=( + '-f[suppress read of ~/.irbrc]' + '(--noinspect)-m[bc mode (load mathn, fraction, matrix)]' + $opts[(r)*-d\[*] + '(--noinspect)--inspect[use inspect for output]' + "(--inspect)--noinspect[don't use inspect for output]" + '(--noreadline)--readline[use readline extension]' + "(--readline)--noreadline[don't use readline extension]" + '(--prompt --prompt-mode --inf-ruby-mode --simple-prompt --noprompt)'{--prompt,--prompt-mode}'[switch prompt mode]:prompt mode:(default simple xmp inf-ruby)' + '(--prompt --prompt-mode --inf-ruby-mode --simple-prompt --noprompt)'{--inf-ruby-mode,--simple-prompt,--noprompt} + '--tracer[display trace for each command execution]' + '--back-trace-limit[set limit for backtraces]:limit [16]:' + '!--irb_debug:level' + '--context-mode:n' + '(--noecho)--echo[show result]' + "(--echo)--noecho[don't show result]" + '--single-irb[share self with sub-irb]' + '(--noverbose)--verbose[show details]' + "(--verbose)--noverbose[don't show details]" +) + +erb=( + "-P[don't evaluate lines which start with %]" + '-S[specify safe level for running script]:level:(1 2 3 4)' + '-T[specify trim mode]:mode [0]:((0\:EOL\ remains 1\:EOL\ removed\ if\ line\ ends\ with\ %\> 2\:EOL\ removed\ if\ line\ starts\ with\ \<%\ and\ ends\ with\ %\> -\:EOL\ is\ removed\ if\ line\ ends\ with\ -%\>,\ leading\ whitespace\ removed\ after\ \<%-))' + '(-d --debug)'{-d,--debug}'[set debugging flags (set $DEBUG to true)]' + '-n[used with -x, prepends line number to output]' + '-x[convert eRuby to Ruby]' ) case "$service" in @@ -49,22 +84,48 @@ case "$service" in words=( fake "$words[@]" ) (( CURRENT++ )) _arguments -C -s : "${(@M)opts:#*-[IdvwrK](|[-+])\[*}" && ret=0 + RUBY=ruby + ;; + ruby[0-9.]#) + RUBY=$words[1] + _arguments -C -s -S : $opts $all $common && ret=0 + ;; + irb[0-9.]#) + RUBY=${words[1]/irb/ruby} + _arguments -C -s : $irb $all $common && ret=0 ;; - ruby) - _arguments -C -s -S : "$opts[@]" "$args[@]" && ret=0 + erb[0-9.]#) + RUBY=${words[1]/irb/ruby} + _arguments -C -s : $erb $all \ + '*:erb file:_files -g "*.erb(-.)"' && ret=0 ;; esac case "$state" in + normal) + if (( ! $+opt_args[-e] )); then + shift words + (( CURRENT-- )) + fi + _normal && ret=0 + ;; + charsets) + charsets=( $(_call_program charsets $RUBY -e 'puts\ Encoding.list' 2>/dev/null) ) + # could also add Encoding.aliases.map(&:first) for aliases + desc='charset' + if [[ $curcontext = *option-E-1 ]]; then + if compset -P '*:'; then + desc='internal charset' + else + desc='external charset' + compset -S ':*' || suf=( -S: ) + fi + fi + _wanted charsets expl $desc compadd $suf -a charsets && ret=0 + ;; library) local -a dirs - local cmd - if [[ "$service" = *RUBYOPT* ]]; then - cmd=ruby - else - cmd=$words[1] - fi - dirs=( $(_call_program directories $cmd -e 'puts\ \$:' 2>/dev/null) ${(s.:.)opt_args[-I]} ) + dirs=( $(_call_program libraries $RUBY -e 'puts\ \$:' 2>/dev/null) ${(s.:.)opt_args[-I]} ) _wanted libraries expl library _path_files -W dirs && ret=0 ;; esac diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 3e499b8d0..2be5672da 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -108,7 +108,7 @@ _ssh () { _arguments \ '-q[silence ssh-keygen]' \ "($cmds -P)-b[specify number of bits in key]:bits in key" \ - "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa ecdsa)" \ + "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa ecdsa ed25519)" \ "(${cmds#-p })-N[provide new passphrase]:new passphrase" \ "($cmds -b -t)-C[provide new comment]:new comment" \ '(-D)-f[key file]:key file:_files' \ @@ -223,6 +223,7 @@ _ssh () { 'ecdsa-sha2-nistp256-cert-v01@openssh.com' \ 'ecdsa-sha2-nistp384-cert-v01@openssh.com' \ 'ecdsa-sha2-nistp521-cert-v01@openssh.com' \ + 'ssh-ed25519-cert-v01@openssh.com' \ 'ssh-rsa-cert-v01@openssh.com' \ 'ssh-dss-cert-v01@openssh.com' \ 'ssh-rsa-cert-v00@openssh.com' \ @@ -230,6 +231,7 @@ _ssh () { 'ecdsa-sha2-nistp256' \ 'ecdsa-sha2-nistp384' \ 'ecdsa-sha2-nistp521' \ + 'ssh-ed25519' \ 'ssh-rsa' \ 'ssh-dss' && ret=0 ;; diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index a8f133295..5a4a2d71f 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -573,12 +573,13 @@ function _tmux-new-session() { local -a args args=( '-d[do not attach new session to current terminal]' + '-A[attach to existing session if it already exists]' '-n[name the initial window]:window name' - '-s[name the session]:session name' + '-s[name the session]:session name:__tmux-sessions' '-t[specify target session]:sessions:__tmux-sessions' '*:: :_command' ) - _arguments ${args} + _arguments -s ${args} } function _tmux-new-window() { diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs index a9707ce36..cd5ad3edc 100644 --- a/Completion/Unix/Command/_zfs +++ b/Completion/Unix/Command/_zfs @@ -221,7 +221,7 @@ _zfs() { ("create") _arguments -A "-*" \ '-p[Create parent datasets]' \ - '-o[Set initial properties]:property:_values -s , "property" $create_properties' \ + '*-o[Set initial properties]:property:_values -s , "property" $create_properties' \ - set1 \ ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \ - set2 \ @@ -246,7 +246,7 @@ _zfs() { ("snapshot") _arguments -A "-*" \ '-r[Recursively snapshot all descendant datasets]' \ - '-o[Set property]:property:_values -s , "property" $create_properties' \ + '*-o[Set property]:property:_values -s , "property" $create_properties' \ ':filesystem/volume:_zfs_dataset -t fs -t vol -S@' ;; @@ -263,7 +263,7 @@ _zfs() { _arguments -A "-*" \ '-p[Create parent datasets]' \ '-K[Create encryption key]' \ - '-o[Set property]:property:_values -s , "property" $create_properties' \ + '*-o[Set property]:property:_values -s , "property" $create_properties' \ ':snapshot:_zfs_dataset -t snap' \ ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"' ;; |