73cca9432253ab06c8ad64f96f21effac5532a6d

Author
Alex Light <scialexlight@gmail.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Add zsh completion plugin for rustc (#3159)

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/rust/_rust b/plugins/rust/_rust
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..f4e8f6f7873c9baa0bc64f59eb11530dd753e017
  4--- /dev/null
  5+++ b/plugins/rust/_rust
  6@@ -0,0 +1,191 @@
  7+#compdef rustc
  8+
  9+local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug
 10+
 11+typeset -A opt_args
 12+
 13+_rustc_debuginfo_levels=(
 14+    "0[no debug info]"
 15+    "1[line-tables only (for stacktraces and breakpoints)]"
 16+    "2[full debug info with variable and type information (same as -g)]"
 17+)
 18+
 19+_rustc_crate_types=(
 20+    'bin'
 21+    'lib'
 22+    'rlib'
 23+    'dylib'
 24+    'staticlib'
 25+)
 26+
 27+_rustc_emit_types=(
 28+    'asm'
 29+    'bc'
 30+    'ir'
 31+    'obj'
 32+    'link'
 33+)
 34+_rustc_pretty_types=(
 35+    'normal[un-annotated source]'
 36+    'expanded[crates expanded]'
 37+    'typed[crates  expanded,  with  type  annotations]'
 38+    'identified[fully parenthesized, AST nodes and blocks with IDs]'
 39+    'flowgraph=[graphviz formatted flowgraph for node]:NODEID:'
 40+)
 41+_rustc_color_types=(
 42+    'auto[colorize, if output goes to a tty (default)]'
 43+    'always[always colorize output]'
 44+    'never[never colorize output]'
 45+)
 46+
 47+_rustc_opts_vals=(
 48+    --crate-name='[Specify the name of the crate being built]'
 49+    --crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types"  "$_rustc_crate_types[@]"'
 50+    --emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"'
 51+    --debuginfo='[Emit DWARF debug info to the objects created]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"'
 52+    --dep-info='[Output dependency info to <filename> after compiling]::FILE:_files -/'
 53+    --sysroot='[Override the system root]:PATH:_files -/'
 54+    --cfg='[Configure the compilation environment]:SPEC:'
 55+    --out-dir='[Write output to compiler-chosen filename in <dir>.  Ignored  if  -o  is  specified. (default the current directory)]:DIR:_files -/'
 56+    -o'[Write output to <filename>. Ignored if more than one --emit is specified.]:FILENAME:_files'
 57+    --opt-level='[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)'
 58+    --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"'
 59+    -L'[Add a directory to the library search path]:DIR:_files -/'
 60+    --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:'
 61+    --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"'
 62+    {-v,--version}'[Print version info and exit]::VERBOSE:(verbose)'
 63+    --explain='[Provide a detailed explanation of an error message]:OPT:'
 64+    --extern'[Specify where an external rust library is located]:ARG:'
 65+)
 66+
 67+_rustc_opts_switches=(
 68+    -g'[Equivalent to --debuginfo=2]'
 69+    {-h,--help}'[Display this message]'
 70+    --no-analysis'[Parse and expand the output, but run no analysis or produce output]'
 71+    --no-trans'[Run all passes except translation; no output]'
 72+    -O'[Equivalent to --opt-level=2]'
 73+    --parse-only'[Parse only; do not compile, assemble, or link]'
 74+    --print-crate-name'[Output the crate name and exit]'
 75+    --print-file-name'[Output the file(s) that would be written if compilation continued and exit]'
 76+    --test'[Build a test harness]'
 77+)
 78+_rustc_opts_codegen=(
 79+    'ar=[Path to the archive utility to use when assembling archives.]:BIN:_path_files'
 80+    'linker=[Path to the linker utility to use when linking libraries, executables, and objects.]:BIN:_path_files'
 81+    'link-args=[A space-separated list of extra arguments to pass to the linker when the linker is invoked.]:ARGS:'
 82+    'target-cpu=[Selects a target processor. If the value is "help", then a list of  available  CPUs is printed.]:CPU:'
 83+    'target-feature=[A space-separated list of features to enable or disable for the target. A preceding "+" enables a feature while a preceding "-" disables it. Available features can be discovered through target-cpu=help.]:FEATURE:'
 84+    'passes=[A space-separated list of extra LLVM passes to run. A value of "list" will cause rustc to print all known passes and exit. The passes specified are appended at the end of the normal pass manager.]:LIST:'
 85+    'llvm-args=[A space-separated list of arguments to pass through to LLVM.]:ARGS:'
 86+    'save-temps[If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated throughout compilation in the output directory.]'
 87+    'rpath[If specified, then the rpath value for dynamic libraries will be set in either dynamic library or executable outputs.]'
 88+    'no-prepopulate-passes[Suppresses pre-population of the LLVM pass manager that is run over the module.]'
 89+    'no-vectorize-loops[Suppresses running the loop vectorization LLVM pass, regardless of optimization level.]'
 90+    'no-vectorize-slp[Suppresses running the LLVM SLP vectorization pass, regardless of optimization level.]'
 91+    'soft-float[Generates software floating point library calls instead of hardware instructions.]'
 92+    'prefer-dynamic[Prefers dynamic linking to static linking.]'
 93+    "no-integrated-as[Force usage of an external assembler rather than LLVM's integrated one.]"
 94+    'no-redzone[disable the use of the redzone]'
 95+    'relocation-model=[The relocation model to use. (default: pic)]:MODEL:(pic static dynamic-no-pic)'
 96+    'code-model=[choose the code model to use (llc -code-model for details)]:MODEL:'
 97+    'metadata=[metadata to mangle symbol names with]:VAL:'
 98+    'extra-filenames=[extra data to put in each output filename]:VAL:'
 99+    'codegen-units=[divide crate into N units to optimize in parallel]:N:'
100+    'help[Show all codegen options]'
101+)
102+
103+_rustc_opts_lint=(
104+    'help[Show a list of all lints]'
105+    'experimental[detects use of #\[experimental\] items]'