Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] shell completion #921

Open
Freed-Wu opened this issue May 11, 2023 · 2 comments
Open

[feature] shell completion #921

Freed-Wu opened this issue May 11, 2023 · 2 comments

Comments

@Freed-Wu
Copy link

Can it provide completions for common shells? TIA!

@Freed-Wu
Copy link
Author

Freed-Wu commented May 15, 2023

This is an example:

/usr/share/zsh/site-functions/_iverilog:

#compdef iverilog

# GNU Linux,Android,NixOS
local targets=({{,/data/data/com.termux/files}/usr,/run/current-system/sw}/lib/ivl/*.conf(N))
targets=(${targets##*/})
targets=(${targets%%.*})
local options=(
  -B"[The iverilog program uses external programs and configuration files to preprocess and compile the Verilog source]:base"
  {-c,-f}"[These flags specify an input file that contains a list of Verilog source files]:file:_files"
  -D"[Defines macro macro with the string 1 as its definition]:macro or macro=defn"
  -P"[Override a parameter in a root module]:parameter=value"
  -d"[Activate a class of compiler debugging messages]:name"
  -E"[Preprocess the Verilog source, but do not compile it]"
  {-g1995,-g2001,-g2001-noconfig,-g2005,-g2005-sv,-g2009,-g2012}"[Select the Verilog language generation to support in the compiler]"
  {-gverilog-ams,-gno-verilog-ams}"[Enable or disable (default) support for Verilog-AMS]"
  {-gassertions,-gsupported-assertions,-gno-assertions}"[Enable (default) or disable SystemVerilog assertions]"
  {-gspecify,-gno-specify}"[Enable or disable (default) specify block support]"
  {-gstd-include,-gno-std-include}"[Enable (default) or disable the search of a standard installation include directory after all other explicit include directories]"
  {-grelative-include,-gno-relative-include}"[Enable or disable (default) adding the local files directory to the beginning of the include file search path]"
  {-gxtypes,-gno-xtypes}"[Enable (default) or disable support for extended types]"
  {-gio-range-error,-gno-io-range-error}"[The standards requires that a vectored port have matching ranges for its port declaration as well as any net/register declaration]"
  {-gstrict-ca-eval,-gno-strict-ca-eval}"[The standard requires that if any input to a continuous assignment expression changes value, the entire expression is re-evaluated]"
  {-gstrict-expr-width,-gno-strict-expr-width}"[Enable or disable (default) strict compliance with the standard rules for determining expression bit lengths]"
  {-gshared-loop-index,-gno-shared-loop-index}"[Enable (default) or disable the exclusion of for-loop control variables from implicit event_expression lists]"
  -I"[Append directory includedir to list of directories searched for Verilog include files]:includedir:_dirs"
  -i"[Ignore missing modules]"
  -L"[This flag adds a directory to the path list used to locate VPI modules]:path:_dirs"
  -l"[Add the specified file to the list of source files to be compiled, but mark it as a library file]:file:_files"
  -M"[This is equivalent to -Mall=path]:path:_files"
  -M"[Write into the file specified by path a list of files that contribute to the compilation of the design]:mode=path"
  -m"[Add this module to the list of VPI modules to be loaded by the simulation]:module"
  -N"[This is used for debugging the compiler proper]:path:_dirs"
  -o"[Place output in the file filename]:filename:_files"
  -p"[Assign a value to a target specific flag]:flag=value"
  -S"[Synthesize]"
  -s"[topmodule Specify the top level module to elaborate]"
  -T"[Use this switch to select min, typ or max times]:expressions:(min typ max)"
  -t"[Use this switch to specify the target output format]:target:($targets)"
  -u"[Treat each source file as a separate compilation unit]"
  -v"[Turn on verbose messages]"
  "(- : *)"-V"[Print the version of the compiler, and exit]"
  -R"[Print the runtime paths of the compiler, and exit]"
  -W"[Turn on different classes of warnings]:class"
  -y"[Append the directory to the library module search path]:libdir:_dirs"
  -Y"[Add suffix to the list of accepted file name suffixes used when searching a library for cells]:suffix"
  "(- : *)"-h"[Show list of command-line options]"
)

_arguments -s -S $options '*: :_files -g "*.(v|vl|verilog)"'

/usr/share/zsh/site-functions/_vvp:

#compdef vvp

local -a options=(
  -i"[This flag causes all output to <stdout> to be unbuffered]"
  -l"[This flag specifies a logfile where all MCI <stdlog> output goes]:logfile"
  -M"[This flag adds a directory to the path list used to locate VPI modules]:path:_dirs"
  -m"[Tell the vvp run time to load the named module before executing the simulation]:module"
  -n"[This flag makes \$stop or a <Control-C> a synonym for \$finish]"
  -N"[This flag does the same thing as -n, but results in an exit code of 1 if the stimulation calls \$stop]"
  -s"[Stop]"
  -v"[Turn on verbose messages]"
  -V"[Print the version of the runtime, and exit]"
  -vcd"[This extended argument sets the wave dump format to VCD]"
  {-lxt,-lxt-speed,-lxt-space}"[These extended arguments set the wave dump format to lxt, possibly with format optimizations]"
  {-lxt2,-lxt2-speed,-lxt2-space,-lx2,-lx2-speed,-lx2-space}"[The LXT2 format is slower than LXT but usually takes less space, and is written out incrementally]"
  {-fst,-fst-speed,-fst-space,-fst-space-speed,-fst-speed-space}"[This is a modern dumping format that is both faster and more compact than the other dumping formats]"
  -none"[This flag can be used by itself or appended to the end of the above dumpers (vcd/lxt/lxt2/lx2/fst) to suppress all waveform output]"
  -sdf-warn"[When loading an SDF annotation file, this option causes the annotator to print warnings for questionable but non-fatal issues.]"
  -sdf-info"[When loading an SDF annotation file, this option causes the annotator to print information about the annotation.]"
  -sdf-verbose"[This is shorthand for -sdf-info -sdf-warn]"
  -compatible"[This extended argument enables improved compatibility with other simulators]"
)

_arguments -s -S $options '*: :_files'

tesseract-ocr/tesseract#4058 can be a reference about where they should be put.

@Freed-Wu
Copy link
Author

Can this project accept a PR about this issue? @martinwhitaker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants