From e42cb911b856f887e9bafc6f474f7d87819da076 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 1 Dec 2025 13:54:15 -0800 Subject: [PATCH] ADDED: Linux autocomplete scripts for bash/zsh Adds kicad-cli command-line parsing into an autocomplete script for bash and a more verbose one for zsh. --- resources/CMakeLists.txt | 13 + resources/linux/autocomplete/_kicad-cli | 1405 +++++++++++++++++ .../autocomplete/generate_bash_completion.py | 144 ++ .../autocomplete/generate_zsh_completion.py | 202 +++ .../autocomplete/kicad-cli-completion.bash | 243 +++ 5 files changed, 2007 insertions(+) create mode 100644 resources/linux/autocomplete/_kicad-cli create mode 100644 resources/linux/autocomplete/generate_bash_completion.py create mode 100644 resources/linux/autocomplete/generate_zsh_completion.py create mode 100644 resources/linux/autocomplete/kicad-cli-completion.bash diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 09c22b25b7..2312cdfd14 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -193,6 +193,19 @@ elseif( UNIX ) PATTERN "*metainfo.xml" PATTERN "*.in" EXCLUDE ) + + # Install bash completion + install( FILES ${PROJECT_SOURCE_DIR}/resources/linux/autocomplete/kicad-cli-completion.bash + DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions + RENAME kicad-cli + COMPONENT resources + ) + + # Install zsh completion + install( FILES ${PROJECT_SOURCE_DIR}/resources/linux/autocomplete/_kicad-cli + DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions + COMPONENT resources + ) endif() add_subdirectory(bitmaps_png) diff --git a/resources/linux/autocomplete/_kicad-cli b/resources/linux/autocomplete/_kicad-cli new file mode 100644 index 0000000000..4c4dd61d70 --- /dev/null +++ b/resources/linux/autocomplete/_kicad-cli @@ -0,0 +1,1405 @@ +#compdef kicad-cli + +_kicad_cli_commands() { + local -a commands + commands=( + 'fp:Footprint and Footprint Libraries' + 'jobset:Jobset' + 'pcb:PCB' + 'sch:Schematics' + 'sym:Symbol and Symbol Libraries' + 'version:Reports the version info in various formats' + ) + _describe -t commands 'command' commands +} +_kicad_cli() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--version -v)'{--version,-v}'[prints version information and exits]' \ + '1: :_kicad_cli_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (fp) + _kicad_cli_fp + ;; + (jobset) + _kicad_cli_jobset + ;; + (pcb) + _kicad_cli_pcb + ;; + (sch) + _kicad_cli_sch + ;; + (sym) + _kicad_cli_sym + ;; + (version) + _kicad_cli_version + ;; + esac + ;; + esac +} + +_kicad_cli_fp_commands() { + local -a commands + commands=( + 'export:Export utilities (svg)' + 'upgrade:Upgrades the footprint library to the current kicad version format' + ) + _describe -t commands 'command' commands +} +_kicad_cli_fp() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '1: :_kicad_cli_fp_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (export) + _kicad_cli_fp_export + ;; + (upgrade) + _kicad_cli_fp_upgrade + ;; + esac + ;; + esac +} + +_kicad_cli_fp_export_commands() { + local -a commands + commands=( + 'svg:Exports the footprint or entire footprint library to SVG' + ) + _describe -t commands 'command' commands +} +_kicad_cli_fp_export() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '1: :_kicad_cli_fp_export_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (svg) + _kicad_cli_fp_export_svg + ;; + esac + ;; + esac +} + +_kicad_cli_fp_export_svg() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--black-and-white[Black and white only]' \ + '(--cdnp --crossout-DNP-footprints-on-fab-layers)'{--cdnp,--crossout-DNP-footprints-on-fab-layers}'[Plot an '\''X'\'' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '(--footprint --fp)'{--footprint,--fp}'[Specific footprint to export within the library \[nargs=0..1\] \[default: ""\]]' \ + '(--hdnp --hide-DNP-footprints-on-fab-layers)'{--hdnp,--hide-DNP-footprints-on-fab-layers}'[Don'\''t plot text & graphics of DNP footprints on fab layers]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--layers -l)'{--layers,-l}'[Comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '(--sdnp --sketch-DNP-footprints-on-fab-layers)'{--sdnp,--sketch-DNP-footprints-on-fab-layers}'[Plot graphics of DNP footprints in sketch mode on fab layers]' \ + '(--sketch-pads-on-fab-layers --sp)'{--sketch-pads-on-fab-layers,--sp}'[Draw pad outlines and their numbers on front and back fab layers]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to footprint editor settings) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_fp_upgrade() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--force[Forces the footprint library to be resaved regardless of versioning]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_jobset_commands() { + local -a commands + commands=( + 'run:Runs a jobset file' + ) + _describe -t commands 'command' commands +} +_kicad_cli_jobset() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '1: :_kicad_cli_jobset_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (run) + _kicad_cli_jobset_run + ;; + esac + ;; + esac +} + +_kicad_cli_jobset_run() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--file -f)'{--file,-f}'[Jobset file to be run \[nargs=0..1\] \[default: ""\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--output[Jobset file output to generate, leave blank for all outputs defined in the jobset \[nargs=0..1\] \[default: ""\]]' \ + '--stop-on-error[Stops processing jobs as they are executed sequentially on the first failure of a job]' \ + && return 0 +} + +_kicad_cli_pcb_commands() { + local -a commands + commands=( + 'drc:Runs the Design Rules Check (DRC) on the PCB and creates a report' + 'export:Export utilities (Gerbers, drill, position files, etc)' + 'render:Renders the PCB in 3D view to PNG or JPEG image' + 'upgrade:Upgrade the board file'\''s format to the latest one' + ) + _describe -t commands 'command' commands +} +_kicad_cli_pcb() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '1: :_kicad_cli_pcb_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (drc) + _kicad_cli_pcb_drc + ;; + (export) + _kicad_cli_pcb_export + ;; + (render) + _kicad_cli_pcb_render + ;; + (upgrade) + _kicad_cli_pcb_upgrade + ;; + esac + ;; + esac +} + +_kicad_cli_pcb_drc() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--all-track-errors[Report all errors for each track]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--exit-code-violations[Return a nonzero exit code if DRC violations exist]' \ + '--format[Output file format, options: json, report \[nargs=0..1\] \[default: "report"\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--refill-zones[Refill zones before running DRC]' \ + '--save-board[Save the board after DRC, must be used with --refill-zones]' \ + '--schematic-parity[Test for parity between PCB and schematic]' \ + '--severity-all[Report all DRC violations, this is equivalent to including all the other severity arguments]' \ + '--severity-error[Report all DRC error level violations, this can be combined with the other severity arguments]' \ + '--severity-exclusions[Report all excluded DRC violations, this can be combined with the other severity arguments]' \ + '--severity-warning[Report all DRC warning level violations, this can be combined with the other severity arguments]' \ + '--units[Report units; valid options: in, mm, mils \[nargs=0..1\] \[default: "mm"\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_commands() { + local -a commands + commands=( + '3dpdf:Export PDF' + 'brep:Export BREP' + 'drill:Generate Drill Files' + 'dxf:Generate a DXF from a list of layers' + 'gencad:Export the PCB in Gencad format' + 'gerber:Plot given layers to a single Gerber file' + 'gerbers:Plot multiple Gerbers for a PCB, including the ability to use stored board plot settings' + 'glb:Export GLB (binary GLTF)' + 'hpgl:No longer supported as of KiCad 10.0.' + 'ipc2581:Export the PCB in IPC-2581 format' + 'ipcd356:Generate IPC-D-356 netlist file' + 'odb:Export the PCB in ODB++ format' + 'pdf:Generate PDF from a list of layers' + 'ply:Export PLY' + 'pos:Generate Position File' + 'ps:Generate Postscript from a list of layers' + 'stats:Generate a board statistics report' + 'step:Export STEP' + 'stl:Export STL' + 'stpz:Export STEPZ' + 'svg:Generate SVG outputs of a given layer list' + 'u3d:Export U3D' + 'vrml:Export VRML' + 'xao:Export XAO' + ) + _describe -t commands 'command' commands +} +_kicad_cli_pcb_export() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '1: :_kicad_cli_pcb_export_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (3dpdf) + _kicad_cli_pcb_export_3dpdf + ;; + (brep) + _kicad_cli_pcb_export_brep + ;; + (drill) + _kicad_cli_pcb_export_drill + ;; + (dxf) + _kicad_cli_pcb_export_dxf + ;; + (gencad) + _kicad_cli_pcb_export_gencad + ;; + (gerber) + _kicad_cli_pcb_export_gerber + ;; + (gerbers) + _kicad_cli_pcb_export_gerbers + ;; + (glb) + _kicad_cli_pcb_export_glb + ;; + (hpgl) + _kicad_cli_pcb_export_hpgl + ;; + (ipc2581) + _kicad_cli_pcb_export_ipc2581 + ;; + (ipcd356) + _kicad_cli_pcb_export_ipcd356 + ;; + (odb) + _kicad_cli_pcb_export_odb + ;; + (pdf) + _kicad_cli_pcb_export_pdf + ;; + (ply) + _kicad_cli_pcb_export_ply + ;; + (pos) + _kicad_cli_pcb_export_pos + ;; + (ps) + _kicad_cli_pcb_export_ps + ;; + (stats) + _kicad_cli_pcb_export_stats + ;; + (step) + _kicad_cli_pcb_export_step + ;; + (stl) + _kicad_cli_pcb_export_stl + ;; + (stpz) + _kicad_cli_pcb_export_stpz + ;; + (svg) + _kicad_cli_pcb_export_svg + ;; + (u3d) + _kicad_cli_pcb_export_u3d + ;; + (vrml) + _kicad_cli_pcb_export_vrml + ;; + (xao) + _kicad_cli_pcb_export_xao + ;; + esac + ;; + esac +} + +_kicad_cli_pcb_export_3dpdf() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-only[Only generate a board with no components]' \ + '--component-filter[Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported) \[nargs=0..1\] \[default: ""\]]' \ + '--cut-vias-in-body[Cut via holes in board body even if conductor layers are not exported.]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drill-origin[Use Drill Origin for output origin]' \ + '--fill-all-vias[Don'\''t cut via holes in conductor layers.]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '--fuse-shapes[Fuse overlapping geometry together]' \ + '--grid-origin[Use Grid Origin for output origin]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-inner-copper[Export elements on inner copper layers]' \ + '--include-pads[Export pads]' \ + '--include-silkscreen[Export silkscreen graphics as a set of flat faces]' \ + '--include-soldermask[Export soldermask layers as a set of flat faces]' \ + '--include-tracks[Export tracks and vias]' \ + '--include-zones[Export zones]' \ + '--min-distance[Minimum distance between points to treat them as separate ones \[nargs=0..1\] \[default: "0.01mm"\]]' \ + '--net-filter[Only include copper items belonging to nets matching this wildcard \[nargs=0..1\] \[default: ""\]]' \ + '--no-board-body[Exclude board body]' \ + '--no-components[Exclude 3D models for components]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subst-models[Substitute STEP or IGS models with the same name in place of VRML models]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_brep() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-only[Only generate a board with no components]' \ + '--component-filter[Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported) \[nargs=0..1\] \[default: ""\]]' \ + '--cut-vias-in-body[Cut via holes in board body even if conductor layers are not exported.]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drill-origin[Use Drill Origin for output origin]' \ + '--fill-all-vias[Don'\''t cut via holes in conductor layers.]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '--fuse-shapes[Fuse overlapping geometry together]' \ + '--grid-origin[Use Grid Origin for output origin]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-inner-copper[Export elements on inner copper layers]' \ + '--include-pads[Export pads]' \ + '--include-silkscreen[Export silkscreen graphics as a set of flat faces]' \ + '--include-soldermask[Export soldermask layers as a set of flat faces]' \ + '--include-tracks[Export tracks and vias]' \ + '--include-zones[Export zones]' \ + '--min-distance[Minimum distance between points to treat them as separate ones \[nargs=0..1\] \[default: "0.01mm"\]]' \ + '--net-filter[Only include copper items belonging to nets matching this wildcard \[nargs=0..1\] \[default: ""\]]' \ + '--no-board-body[Exclude board body]' \ + '--no-components[Exclude 3D models for components]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subst-models[Substitute STEP or IGS models with the same name in place of VRML models]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_drill() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--drill-origin[Valid options are: absolute,plot \[nargs=0..1\] \[default: "absolute"\]]' \ + '--excellon-min-header[Minimal header]' \ + '--excellon-mirror-y[Mirror Y axis]' \ + '--excellon-oval-format[Valid options are: route,alternate. \[nargs=0..1\] \[default: "alternate"\]]' \ + '--excellon-separate-th[Generate independent files for NPTH and PTH holes]' \ + '(--excellon-units -u)'{--excellon-units,-u}'[Output units, valid options:in,mm \[nargs=0..1\] \[default: "mm"\]]' \ + '--excellon-zeros-format[Valid options are: decimal,suppressleading,suppresstrailing,keep. \[nargs=0..1\] \[default: "decimal"\]]' \ + '--format[Valid options excellon, gerber. \[nargs=0..1\] \[default: "excellon"\]]' \ + '--generate-map[Generate map / summary of drill hits]' \ + '--generate-tenting[Generate a file specifically for tenting]' \ + '--gerber-precision[Precision of Gerber coordinates (5 or 6) \[nargs=0..1\] \[default: 6\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--map-format[Valid options: pdf,gerberx2,ps,dxf,svg \[nargs=0..1\] \[default: "pdf"\]]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_dxf() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--cdnp --crossout-DNP-footprints-on-fab-layers)'{--cdnp,--crossout-DNP-footprints-on-fab-layers}'[Plot an '\''X'\'' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators]' \ + '--check-zones[Check and refill zones if required]' \ + '(--cl --common-layers)'{--cl,--common-layers}'[Layers to include on each plot, comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '--drill-shape-opt[Set pad/via drill shape option (0 = no shape, 1 = small shape, 2 = actual shape) \[nargs=0..1\] \[default: 2\]]' \ + '(--erd --exclude-refdes)'{--erd,--exclude-refdes}'[Exclude the reference designator text]' \ + '(--ev --exclude-value)'{--ev,--exclude-value}'[Exclude the value text]' \ + '(--hdnp --hide-DNP-footprints-on-fab-layers)'{--hdnp,--hide-DNP-footprints-on-fab-layers}'[Don'\''t plot text & graphics of DNP footprints on fab layers]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--ibt --include-border-title)'{--ibt,--include-border-title}'[Include the border and title block]' \ + '(--layers -l)'{--layers,-l}'[Comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '--mode-multi[Generates one or more files with behavior similar to the KiCad GUI plotting. The given output path specifies a directory in which files may be output.]' \ + '--mode-single[Generates a single file with the output arg path acting as the complete directory and filename path. COMMON_LAYER_LIST does not function in this mode. Instead LAYER_LIST controls all layers plotted.]' \ + '(--ou --output-units)'{--ou,--output-units}'[Output units, valid options: mm, in \[nargs=0..1\] \[default: "in"\]]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--plot-invisible-text[Deprecated. Has no effect.]' \ + '--scale[Scale for the PCB, not for the border and title. Use 0 for autoscale \[nargs=0..1\] \[default: 1\]]' \ + '(--sdnp --sketch-DNP-footprints-on-fab-layers)'{--sdnp,--sketch-DNP-footprints-on-fab-layers}'[Plot graphics of DNP footprints in sketch mode on fab layers]' \ + '(--sketch-pads-on-fab-layers --sp)'{--sketch-pads-on-fab-layers,--sp}'[Draw pad outlines and their numbers on front and back fab layers]' \ + '--subtract-soldermask[Subtract soldermask from silkscreen]' \ + '(--uc --use-contours)'{--uc,--use-contours}'[Plot graphic items using their contours]' \ + '(--udo --use-drill-origin)'{--udo,--use-drill-origin}'[Plot using the drill/place file origin]' \ + && return 0 +} + +_kicad_cli_pcb_export_gencad() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '(--flip-bottom-pads -f)'{--flip-bottom-pads,-f}'[Flip bottom footprint padstacks]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--store-origin-coord[Save the origin coordinates in the file]' \ + '--unique-footprints[Generate a new shape for each footprint instance (do not reuse shapes)]' \ + '--unique-pins[Generate unique pin names]' \ + '--use-drill-origin[Use drill/place file origin as origin]' \ + && return 0 +} + +_kicad_cli_pcb_export_gerber() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--cdnp --crossout-DNP-footprints-on-fab-layers)'{--cdnp,--crossout-DNP-footprints-on-fab-layers}'[Plot an '\''X'\'' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators]' \ + '--check-zones[Check and refill zones if required]' \ + '(--cl --common-layers)'{--cl,--common-layers}'[Layers to include on each plot, comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--disable-aperture-macros[Disable aperture macros]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '(--erd --exclude-refdes)'{--erd,--exclude-refdes}'[Exclude the reference designator text]' \ + '(--ev --exclude-value)'{--ev,--exclude-value}'[Exclude the value text]' \ + '(--hdnp --hide-DNP-footprints-on-fab-layers)'{--hdnp,--hide-DNP-footprints-on-fab-layers}'[Don'\''t plot text & graphics of DNP footprints on fab layers]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--ibt --include-border-title)'{--ibt,--include-border-title}'[Include the border and title block]' \ + '(--layers -l)'{--layers,-l}'[Comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '--no-netlist[Do not generate netlist attributes]' \ + '--no-protel-ext[Use KiCad Gerber file extension]' \ + '--no-x2[Do not use the extended X2 format]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--plot-invisible-text[Deprecated. Has no effect.]' \ + '--precision[Precision of Gerber coordinates, valid options: 5 or 6 \[nargs=0..1\] \[default: 6\]]' \ + '(--sdnp --sketch-DNP-footprints-on-fab-layers)'{--sdnp,--sketch-DNP-footprints-on-fab-layers}'[Plot graphics of DNP footprints in sketch mode on fab layers]' \ + '(--sketch-pads-on-fab-layers --sp)'{--sketch-pads-on-fab-layers,--sp}'[Draw pad outlines and their numbers on front and back fab layers]' \ + '--subtract-soldermask[Subtract soldermask from silkscreen]' \ + '--use-drill-file-origin[Use drill/place file origin]' \ + && return 0 +} + +_kicad_cli_pcb_export_gerbers() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-plot-params[Use the Gerber plot settings already configured in the board file]' \ + '(--cdnp --crossout-DNP-footprints-on-fab-layers)'{--cdnp,--crossout-DNP-footprints-on-fab-layers}'[Plot an '\''X'\'' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators]' \ + '--check-zones[Check and refill zones if required]' \ + '(--cl --common-layers)'{--cl,--common-layers}'[Layers to include on each plot, comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--disable-aperture-macros[Disable aperture macros]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '(--erd --exclude-refdes)'{--erd,--exclude-refdes}'[Exclude the reference designator text]' \ + '(--ev --exclude-value)'{--ev,--exclude-value}'[Exclude the value text]' \ + '(--hdnp --hide-DNP-footprints-on-fab-layers)'{--hdnp,--hide-DNP-footprints-on-fab-layers}'[Don'\''t plot text & graphics of DNP footprints on fab layers]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--ibt --include-border-title)'{--ibt,--include-border-title}'[Include the border and title block]' \ + '(--layers -l)'{--layers,-l}'[Comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '--no-netlist[Do not generate netlist attributes]' \ + '--no-protel-ext[Use KiCad Gerber file extension]' \ + '--no-x2[Do not use the extended X2 format]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--plot-invisible-text[Deprecated. Has no effect.]' \ + '--precision[Precision of Gerber coordinates, valid options: 5 or 6 \[nargs=0..1\] \[default: 6\]]' \ + '(--sdnp --sketch-DNP-footprints-on-fab-layers)'{--sdnp,--sketch-DNP-footprints-on-fab-layers}'[Plot graphics of DNP footprints in sketch mode on fab layers]' \ + '(--sketch-pads-on-fab-layers --sp)'{--sketch-pads-on-fab-layers,--sp}'[Draw pad outlines and their numbers on front and back fab layers]' \ + '--subtract-soldermask[Subtract soldermask from silkscreen]' \ + '--use-drill-file-origin[Use drill/place file origin]' \ + && return 0 +} + +_kicad_cli_pcb_export_glb() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-only[Only generate a board with no components]' \ + '--component-filter[Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported) \[nargs=0..1\] \[default: ""\]]' \ + '--cut-vias-in-body[Cut via holes in board body even if conductor layers are not exported.]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drill-origin[Use Drill Origin for output origin]' \ + '--fill-all-vias[Don'\''t cut via holes in conductor layers.]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '--fuse-shapes[Fuse overlapping geometry together]' \ + '--grid-origin[Use Grid Origin for output origin]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-inner-copper[Export elements on inner copper layers]' \ + '--include-pads[Export pads]' \ + '--include-silkscreen[Export silkscreen graphics as a set of flat faces]' \ + '--include-soldermask[Export soldermask layers as a set of flat faces]' \ + '--include-tracks[Export tracks and vias]' \ + '--include-zones[Export zones]' \ + '--min-distance[Minimum distance between points to treat them as separate ones \[nargs=0..1\] \[default: "0.01mm"\]]' \ + '--net-filter[Only include copper items belonging to nets matching this wildcard \[nargs=0..1\] \[default: ""\]]' \ + '--no-board-body[Exclude board body]' \ + '--no-components[Exclude 3D models for components]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subst-models[Substitute STEP or IGS models with the same name in place of VRML models]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_hpgl() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_ipc2581() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--bom-col-dist[Name to insert into Bill of Material Distributor Column \[nargs=0..1\] \[default: ""\]]' \ + '--bom-col-dist-pn[Name of the part field to use for the Bill of Material Distributor Part Number Column \[nargs=0..1\] \[default: ""\]]' \ + '--bom-col-int-id[Name of the part field to use for the Bill of Material Internal Id Column \[nargs=0..1\] \[default: ""\]]' \ + '--bom-col-mfg[Name of the part field to use for the Bill of Material Manufacturer Column \[nargs=0..1\] \[default: ""\]]' \ + '--bom-col-mfg-pn[Name of the part field to use for the Bill of Material Manufacturer Part Number Column \[nargs=0..1\] \[default: ""\]]' \ + '--compress[Compress the output]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--precision[Precision \[nargs=0..1\] \[default: 6\]]' \ + '--units[Units \[nargs=0..1\] \[default: "mm"\]]' \ + '--version[IPC-2581 standard version \[nargs=0..1\] \[default: "C"\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_ipcd356() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_odb() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--compression[Compression mode \[nargs=0..1\] \[default: "zip"\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--precision[Precision \[nargs=0..1\] \[default: 2\]]' \ + '--units[Units \[nargs=0..1\] \[default: "mm"\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_pdf() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--bg-color[Background color, can be in hex #rrggbb, #rrggbbaa; or css rgb(r,g,b), rgba(r,g,b,a) format \[nargs=0..1\] \[default: ""\]]' \ + '--black-and-white[Black and white only]' \ + '(--cdnp --crossout-DNP-footprints-on-fab-layers)'{--cdnp,--crossout-DNP-footprints-on-fab-layers}'[Plot an '\''X'\'' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators]' \ + '--check-zones[Check and refill zones if required]' \ + '(--cl --common-layers)'{--cl,--common-layers}'[Layers to include on each plot, comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '--drill-shape-opt[Set pad/via drill shape option (0 = no shape, 1 = small shape, 2 = actual shape) \[nargs=0..1\] \[default: 2\]]' \ + '(--erd --exclude-refdes)'{--erd,--exclude-refdes}'[Exclude the reference designator text]' \ + '(--ev --exclude-value)'{--ev,--exclude-value}'[Exclude the value text]' \ + '(--hdnp --hide-DNP-footprints-on-fab-layers)'{--hdnp,--hide-DNP-footprints-on-fab-layers}'[Don'\''t plot text & graphics of DNP footprints on fab layers]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--ibt --include-border-title)'{--ibt,--include-border-title}'[Include the border and title block]' \ + '(--layers -l)'{--layers,-l}'[Comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--mirror -m)'{--mirror,-m}'[Mirror the board (useful for trying to show bottom layers)]' \ + '--mode-multipage[Plot the layers to a single PDF file with multiple pages]' \ + '--mode-separate[Plot the layers to individual PDF files]' \ + '--mode-single[Generates a single file with the output arg path acting as the complete directory and filename path. COMMON_LAYER_LIST does not function in this mode. Instead LAYER_LIST controls all layers plotted.]' \ + '(--negative -n)'{--negative,-n}'[Plot as negative (useful for directly etching from the export)]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--plot-invisible-text[Deprecated. Has no effect.]' \ + '--scale[Scale for the PCB, not for the border and title. Use 0 for autoscale \[nargs=0..1\] \[default: 1\]]' \ + '(--sdnp --sketch-DNP-footprints-on-fab-layers)'{--sdnp,--sketch-DNP-footprints-on-fab-layers}'[Plot graphics of DNP footprints in sketch mode on fab layers]' \ + '(--sketch-pads-on-fab-layers --sp)'{--sketch-pads-on-fab-layers,--sp}'[Draw pad outlines and their numbers on front and back fab layers]' \ + '--subtract-soldermask[Subtract soldermask from silkscreen]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to PCB Editor settings) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_ply() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-only[Only generate a board with no components]' \ + '--component-filter[Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported) \[nargs=0..1\] \[default: ""\]]' \ + '--cut-vias-in-body[Cut via holes in board body even if conductor layers are not exported.]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drill-origin[Use Drill Origin for output origin]' \ + '--fill-all-vias[Don'\''t cut via holes in conductor layers.]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '--fuse-shapes[Fuse overlapping geometry together]' \ + '--grid-origin[Use Grid Origin for output origin]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-inner-copper[Export elements on inner copper layers]' \ + '--include-pads[Export pads]' \ + '--include-silkscreen[Export silkscreen graphics as a set of flat faces]' \ + '--include-soldermask[Export soldermask layers as a set of flat faces]' \ + '--include-tracks[Export tracks and vias]' \ + '--include-zones[Export zones]' \ + '--min-distance[Minimum distance between points to treat them as separate ones \[nargs=0..1\] \[default: "0.01mm"\]]' \ + '--net-filter[Only include copper items belonging to nets matching this wildcard \[nargs=0..1\] \[default: ""\]]' \ + '--no-board-body[Exclude board body]' \ + '--no-components[Exclude 3D models for components]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subst-models[Substitute STEP or IGS models with the same name in place of VRML models]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_pos() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--bottom-negate-x[Use negative X coordinates for footprints on bottom layer (ascii or csv formats only)]' \ + '--exclude-dnp[Exclude all footprints with the Do Not Populate flag set]' \ + '--exclude-fp-th[Exclude all footprints with through-hole pads (ascii or csv only)]' \ + '--format[Valid options: ascii,csv,gerber \[nargs=0..1\] \[default: "ascii"\]]' \ + '--gerber-board-edge[Include board edge layer (Gerber only)]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--side[Valid options: front,back,both. Gerber format only supports "front" or "back". \[nargs=0..1\] \[default: "both"\]]' \ + '--smd-only[Include only SMD footprints (ascii or csv only)]' \ + '--units[Output units; ascii or csv format only; valid options: in,mm \[nargs=0..1\] \[default: "in"\]]' \ + '--use-drill-file-origin[Use drill/place file origin (ascii or csv only)]' \ + && return 0 +} + +_kicad_cli_pcb_export_ps() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--black-and-white[Black and white only]' \ + '(--cdnp --crossout-DNP-footprints-on-fab-layers)'{--cdnp,--crossout-DNP-footprints-on-fab-layers}'[Plot an '\''X'\'' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators]' \ + '--check-zones[Check and refill zones if required]' \ + '(--cl --common-layers)'{--cl,--common-layers}'[Layers to include on each plot, comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '--drill-shape-opt[Set pad/via drill shape option (0 = no shape, 1 = small shape, 2 = actual shape) \[nargs=0..1\] \[default: 2\]]' \ + '(--erd --exclude-refdes)'{--erd,--exclude-refdes}'[Exclude the reference designator text]' \ + '(--ev --exclude-value)'{--ev,--exclude-value}'[Exclude the value text]' \ + '(--force-a4 -A)'{--force-a4,-A}'[Force A4 paper size.]' \ + '(--hdnp --hide-DNP-footprints-on-fab-layers)'{--hdnp,--hide-DNP-footprints-on-fab-layers}'[Don'\''t plot text & graphics of DNP footprints on fab layers]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--ibt --include-border-title)'{--ibt,--include-border-title}'[Include the border and title block]' \ + '(--layers -l)'{--layers,-l}'[Comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--mirror -m)'{--mirror,-m}'[Mirror the board (useful for trying to show bottom layers)]' \ + '--mode-multi[Generates one or more files with behavior similar to the KiCad GUI plotting. The given output path specifies a directory in which files may be output.]' \ + '--mode-single[Generates a single file with the output arg path acting as the complete directory and filename path. COMMON_LAYER_LIST does not function in this mode. Instead LAYER_LIST controls all layers plotted.]' \ + '(--negative -n)'{--negative,-n}'[Plot as negative (useful for directly etching from the export)]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--scale[Scale for the PCB, not for the border and title. Use 0 for autoscale \[nargs=0..1\] \[default: 1\]]' \ + '(--sdnp --sketch-DNP-footprints-on-fab-layers)'{--sdnp,--sketch-DNP-footprints-on-fab-layers}'[Plot graphics of DNP footprints in sketch mode on fab layers]' \ + '(--sketch-pads-on-fab-layers --sp)'{--sketch-pads-on-fab-layers,--sp}'[Draw pad outlines and their numbers on front and back fab layers]' \ + '--subtract-soldermask[Subtract soldermask from silkscreen]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to PCB Editor settings) \[nargs=0..1\] \[default: ""\]]' \ + '(--track-width-correction -C)'{--track-width-correction,-C}'[Track width correction \[mm\]. Used to compensate errors in track widths, pad and via sizes. \[nargs=0..1\] \[default: 0\]]' \ + '(--x-scale-factor -X)'{--x-scale-factor,-X}'[X scale adjust for exact scale. \[nargs=0..1\] \[default: 1\]]' \ + '(--y-scale-factor -Y)'{--y-scale-factor,-Y}'[Y scale adjust for exact scale. \[nargs=0..1\] \[default: 1\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_stats() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--exclude-footprints-without-pads[Exclude footprints without pads]' \ + '--format[Output file format, options: json, report \[nargs=0..1\] \[default: "report"\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subtract-holes-from-board[Subtract holes from the board area]' \ + '--subtract-holes-from-copper[Subtract holes from copper areas]' \ + '--units[Report units; valid options: in, mm \[nargs=0..1\] \[default: "mm"\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_step() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-only[Only generate a board with no components]' \ + '--component-filter[Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported) \[nargs=0..1\] \[default: ""\]]' \ + '--cut-vias-in-body[Cut via holes in board body even if conductor layers are not exported.]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drill-origin[Use Drill Origin for output origin]' \ + '--fill-all-vias[Don'\''t cut via holes in conductor layers.]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '--fuse-shapes[Fuse overlapping geometry together]' \ + '--grid-origin[Use Grid Origin for output origin]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-inner-copper[Export elements on inner copper layers]' \ + '--include-pads[Export pads]' \ + '--include-silkscreen[Export silkscreen graphics as a set of flat faces]' \ + '--include-soldermask[Export soldermask layers as a set of flat faces]' \ + '--include-tracks[Export tracks and vias]' \ + '--include-zones[Export zones]' \ + '--min-distance[Minimum distance between points to treat them as separate ones \[nargs=0..1\] \[default: "0.01mm"\]]' \ + '--net-filter[Only include copper items belonging to nets matching this wildcard \[nargs=0..1\] \[default: ""\]]' \ + '--no-board-body[Exclude board body]' \ + '--no-components[Exclude 3D models for components]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-optimize-step[Do not optimize STEP file (enables writing parametric curves)]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subst-models[Substitute STEP or IGS models with the same name in place of VRML models]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_stl() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-only[Only generate a board with no components]' \ + '--component-filter[Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported) \[nargs=0..1\] \[default: ""\]]' \ + '--cut-vias-in-body[Cut via holes in board body even if conductor layers are not exported.]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drill-origin[Use Drill Origin for output origin]' \ + '--fill-all-vias[Don'\''t cut via holes in conductor layers.]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '--fuse-shapes[Fuse overlapping geometry together]' \ + '--grid-origin[Use Grid Origin for output origin]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-inner-copper[Export elements on inner copper layers]' \ + '--include-pads[Export pads]' \ + '--include-silkscreen[Export silkscreen graphics as a set of flat faces]' \ + '--include-soldermask[Export soldermask layers as a set of flat faces]' \ + '--include-tracks[Export tracks and vias]' \ + '--include-zones[Export zones]' \ + '--min-distance[Minimum distance between points to treat them as separate ones \[nargs=0..1\] \[default: "0.01mm"\]]' \ + '--net-filter[Only include copper items belonging to nets matching this wildcard \[nargs=0..1\] \[default: ""\]]' \ + '--no-board-body[Exclude board body]' \ + '--no-components[Exclude 3D models for components]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subst-models[Substitute STEP or IGS models with the same name in place of VRML models]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_stpz() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-only[Only generate a board with no components]' \ + '--component-filter[Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported) \[nargs=0..1\] \[default: ""\]]' \ + '--cut-vias-in-body[Cut via holes in board body even if conductor layers are not exported.]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drill-origin[Use Drill Origin for output origin]' \ + '--fill-all-vias[Don'\''t cut via holes in conductor layers.]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '--fuse-shapes[Fuse overlapping geometry together]' \ + '--grid-origin[Use Grid Origin for output origin]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-inner-copper[Export elements on inner copper layers]' \ + '--include-pads[Export pads]' \ + '--include-silkscreen[Export silkscreen graphics as a set of flat faces]' \ + '--include-soldermask[Export soldermask layers as a set of flat faces]' \ + '--include-tracks[Export tracks and vias]' \ + '--include-zones[Export zones]' \ + '--min-distance[Minimum distance between points to treat them as separate ones \[nargs=0..1\] \[default: "0.01mm"\]]' \ + '--net-filter[Only include copper items belonging to nets matching this wildcard \[nargs=0..1\] \[default: ""\]]' \ + '--no-board-body[Exclude board body]' \ + '--no-components[Exclude 3D models for components]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-optimize-step[Do not optimize STEP file (enables writing parametric curves)]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subst-models[Substitute STEP or IGS models with the same name in place of VRML models]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_svg() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--black-and-white[Black and white only]' \ + '(--cdnp --crossout-DNP-footprints-on-fab-layers)'{--cdnp,--crossout-DNP-footprints-on-fab-layers}'[Plot an '\''X'\'' over the courtyard of DNP footprints on fab layers, and strikeout their reference designators]' \ + '--check-zones[Check and refill zones if required]' \ + '(--cl --common-layers)'{--cl,--common-layers}'[Layers to include on each plot, comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '--drill-shape-opt[Set pad/via drill shape option (0 = no shape, 1 = small shape, 2 = actual shape) \[nargs=0..1\] \[default: 2\]]' \ + '--exclude-drawing-sheet[No drawing sheet]' \ + '--fit-page-to-board[Fit the page to the board]' \ + '(--hdnp --hide-DNP-footprints-on-fab-layers)'{--hdnp,--hide-DNP-footprints-on-fab-layers}'[Don'\''t plot text & graphics of DNP footprints on fab layers]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--layers -l)'{--layers,-l}'[Comma separated list of untranslated layer names to include such as F.Cu,B.Cu \[nargs=0..1\] \[default: ""\]]' \ + '(--mirror -m)'{--mirror,-m}'[Mirror the board (useful for trying to show bottom layers)]' \ + '--mode-multi[Generates one or more files with behavior similar to the KiCad GUI plotting. The given output path specifies a directory in which files may be output.]' \ + '--mode-single[Generates a single file with the output arg path acting as the complete directory and filename path. COMMON_LAYER_LIST does not function in this mode. Instead LAYER_LIST controls all layers plotted.]' \ + '(--negative -n)'{--negative,-n}'[Plot as negative (useful for directly etching from the export)]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--page-size-mode[Set page sizing mode (0 = page with frame and title block, 1 = current page size, 2 = board area only) \[nargs=0..1\] \[default: 0\]]' \ + '--plot-invisible-text[Deprecated. Has no effect.]' \ + '--scale[Scale for the PCB, not for the border and title. Use 0 for autoscale \[nargs=0..1\] \[default: 1\]]' \ + '(--sdnp --sketch-DNP-footprints-on-fab-layers)'{--sdnp,--sketch-DNP-footprints-on-fab-layers}'[Plot graphics of DNP footprints in sketch mode on fab layers]' \ + '(--sketch-pads-on-fab-layers --sp)'{--sketch-pads-on-fab-layers,--sp}'[Draw pad outlines and their numbers on front and back fab layers]' \ + '--subtract-soldermask[Subtract soldermask from silkscreen]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to PCB editor settings) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_u3d() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-only[Only generate a board with no components]' \ + '--component-filter[Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported) \[nargs=0..1\] \[default: ""\]]' \ + '--cut-vias-in-body[Cut via holes in board body even if conductor layers are not exported.]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drill-origin[Use Drill Origin for output origin]' \ + '--fill-all-vias[Don'\''t cut via holes in conductor layers.]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '--fuse-shapes[Fuse overlapping geometry together]' \ + '--grid-origin[Use Grid Origin for output origin]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-inner-copper[Export elements on inner copper layers]' \ + '--include-pads[Export pads]' \ + '--include-silkscreen[Export silkscreen graphics as a set of flat faces]' \ + '--include-soldermask[Export soldermask layers as a set of flat faces]' \ + '--include-tracks[Export tracks and vias]' \ + '--include-zones[Export zones]' \ + '--min-distance[Minimum distance between points to treat them as separate ones \[nargs=0..1\] \[default: "0.01mm"\]]' \ + '--net-filter[Only include copper items belonging to nets matching this wildcard \[nargs=0..1\] \[default: ""\]]' \ + '--no-board-body[Exclude board body]' \ + '--no-components[Exclude 3D models for components]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subst-models[Substitute STEP or IGS models with the same name in place of VRML models]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_vrml() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--models-dir[Name of folder to create and store 3d models in, if not specified or empty, the models will be embedded in main exported VRML file \[nargs=0..1\] \[default: ""\]]' \ + '--models-relative[Used with --models-dir to output relative paths in the resulting file]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--units[Output units; valid options: mm, m, in, tenths \[nargs=0..1\] \[default: "in"\]]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_export_xao() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--board-only[Only generate a board with no components]' \ + '--component-filter[Only include component 3D models matching this list of reference designators (comma-separated, wildcards supported) \[nargs=0..1\] \[default: ""\]]' \ + '--cut-vias-in-body[Cut via holes in board body even if conductor layers are not exported.]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--drill-origin[Use Drill Origin for output origin]' \ + '--fill-all-vias[Don'\''t cut via holes in conductor layers.]' \ + '(--force -f)'{--force,-f}'[Overwrite output file]' \ + '--fuse-shapes[Fuse overlapping geometry together]' \ + '--grid-origin[Use Grid Origin for output origin]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-inner-copper[Export elements on inner copper layers]' \ + '--include-pads[Export pads]' \ + '--include-silkscreen[Export silkscreen graphics as a set of flat faces]' \ + '--include-soldermask[Export soldermask layers as a set of flat faces]' \ + '--include-tracks[Export tracks and vias]' \ + '--include-zones[Export zones]' \ + '--min-distance[Minimum distance between points to treat them as separate ones \[nargs=0..1\] \[default: "0.01mm"\]]' \ + '--net-filter[Only include copper items belonging to nets matching this wildcard \[nargs=0..1\] \[default: ""\]]' \ + '--no-board-body[Exclude board body]' \ + '--no-components[Exclude 3D models for components]' \ + '--no-dnp[Exclude 3D models for components with '\''Do not populate'\'' attribute]' \ + '--no-unspecified[Exclude 3D models for components with '\''Unspecified'\'' footprint type]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--subst-models[Substitute STEP or IGS models with the same name in place of VRML models]' \ + '--user-origin[User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_pcb_render() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--background[Image background. Options: default, transparent, opaque. Default: transparent for PNG, opaque for JPEG \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--floor[Enables floor, shadows and post-processing, even if disabled in quality setting]' \ + '(--height -h)'{--height,-h}'[Image height \[nargs=0..1\] \[default: 900\]]' \ + '--help[Shows help message and exits]' \ + '--light-bottom[Bottom light intensity, format '\''R,G,B'\'' or a single number, range: 0-1 \[nargs=0..1\] \[default: ""\]]' \ + '--light-camera[Camera light intensity, format '\''R,G,B'\'' or a single number, range: 0-1 \[nargs=0..1\] \[default: ""\]]' \ + '--light-side[Side lights intensity, format '\''R,G,B'\'' or a single number, range: 0-1 \[nargs=0..1\] \[default: ""\]]' \ + '--light-side-elevation[Side lights elevation angle in degrees, range: 0-90 \[nargs=0..1\] \[default: 60\]]' \ + '--light-top[Top light intensity, format '\''R,G,B'\'' or a single number, range: 0-1 \[nargs=0..1\] \[default: ""\]]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--pan[Pan camera, format '\''X,Y,Z'\'' e.g.: '\''3,0,0'\'' \[nargs=0..1\] \[default: ""\]]' \ + '--perspective[Use perspective projection instead of orthogonal]' \ + '--pivot[Set pivot point relative to the board center in centimeters, format '\''X,Y,Z'\'' e.g.: '\''-10,2,0'\'' \[nargs=0..1\] \[default: ""\]]' \ + '--preset[Appearance preset. Options: follow_pcb_editor, follow_plot_settings, or user-defined preset name \[nargs=0..1\] \[default: "follow_plot_settings"\]]' \ + '--quality[Render quality. Options: basic, high, user, job_settings \[nargs=0..1\] \[default: "basic"\]]' \ + '--rotate[Rotate board, format '\''X,Y,Z'\'' e.g.: '\''-45,0,45'\'' for isometric view \[nargs=0..1\] \[default: ""\]]' \ + '--side[Render from side. Options: top, bottom, left, right, front, back \[nargs=0..1\] \[default: "top"\]]' \ + '--use-board-stackup-colors[Colors defined in board stackup override those in preset \[nargs=0..1\] \[default: true\]]' \ + '(--width -w)'{--width,-w}'[Image width \[nargs=0..1\] \[default: 1600\]]' \ + '--zoom[Camera zoom \[nargs=0..1\] \[default: 1\]]' \ + && return 0 +} + +_kicad_cli_pcb_upgrade() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--force[Forces the board file to be resaved regardless of versioning]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + && return 0 +} + +_kicad_cli_sch_commands() { + local -a commands + commands=( + 'erc:Runs the Electrical Rules Check (ERC) on the schematic and creates a report' + 'export:Export utilities (netlist, pdf, bom, etc)' + 'upgrade:Upgrade the schematic file'\''s format to the latest one' + ) + _describe -t commands 'command' commands +} +_kicad_cli_sch() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '1: :_kicad_cli_sch_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (erc) + _kicad_cli_sch_erc + ;; + (export) + _kicad_cli_sch_export + ;; + (upgrade) + _kicad_cli_sch_upgrade + ;; + esac + ;; + esac +} + +_kicad_cli_sch_erc() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--exit-code-violations[Return a nonzero exit code if ERC violations exist]' \ + '--format[Output file format, options: json, report \[nargs=0..1\] \[default: "report"\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--severity-all[Report all ERC violations, this is equivalent to including all the other severity arguments]' \ + '--severity-error[Report all ERC error level violations, this can be combined with the other severity arguments]' \ + '--severity-exclusions[Report all excluded ERC violations, this can be combined with the other severity arguments]' \ + '--severity-warning[Report all ERC warning level violations, this can be combined with the other severity arguments]' \ + '--units[Report units; valid options: in, mm, mils \[nargs=0..1\] \[default: "mm"\]]' \ + && return 0 +} + +_kicad_cli_sch_export_commands() { + local -a commands + commands=( + 'bom:Generate a Bill of Materials (BOM)' + 'dxf:Export DXF' + 'hpgl:Export HPGL' + 'netlist:Export a netlist' + 'pdf:Export PDF' + 'ps:Export PS' + 'python-bom:Export the legacy BOM XML format used in the schematic editor with Python scripts' + 'svg:Export SVG' + ) + _describe -t commands 'command' commands +} +_kicad_cli_sch_export() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '1: :_kicad_cli_sch_export_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (bom) + _kicad_cli_sch_export_bom + ;; + (dxf) + _kicad_cli_sch_export_dxf + ;; + (hpgl) + _kicad_cli_sch_export_hpgl + ;; + (netlist) + _kicad_cli_sch_export_netlist + ;; + (pdf) + _kicad_cli_sch_export_pdf + ;; + (ps) + _kicad_cli_sch_export_ps + ;; + (python-bom) + _kicad_cli_sch_export_python_bom + ;; + (svg) + _kicad_cli_sch_export_svg + ;; + esac + ;; + esac +} + +_kicad_cli_sch_export_bom() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--exclude-dnp[Exclude symbols marked Do-Not-Populate.]' \ + '--field-delimiter[Separator between output fields/columns. \[nargs=0..1\] \[default: ","\]]' \ + '--fields[An ordered list of fields to export. See documentation for special substitutions. \[nargs=0..1\] \[default: "Reference,Value,Footprint,${QUANTITY},${DNP}"\]]' \ + '--filter[Filter string to remove output lines. \[nargs=0..1\] \[default: ""\]]' \ + '--format-preset[Use a named BOM format preset setting from the schematic, e.g. CSV. \[nargs=0..1\] \[default: ""\]]' \ + '--group-by[Fields to group references by when field values match. \[nargs=0..1\] \[default: ""\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-excluded-from-bom[Deprecated. Has no effect.]' \ + '--keep-line-breaks[Keep line break characters from input fields. Stripped by default.]' \ + '--keep-tabs[Keep tab characters from input fields. Stripped by default.]' \ + '--labels[An ordered list of labels to apply the exported fields. \[nargs=0..1\] \[default: "Refs,Value,Footprint,Qty,DNP"\]]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--preset[Use a named BOM preset setting from the schematic, e.g. "Grouped By Value". \[nargs=0..1\] \[default: ""\]]' \ + '--ref-delimiter[Character to place between individual references. \[nargs=0..1\] \[default: ","\]]' \ + '--ref-range-delimiter[Character to place in ranges of references. Leave blank for no ranges. \[nargs=0..1\] \[default: "-"\]]' \ + '--sort-asc[Sort ascending (true) or descending (false). \[nargs=0..1\] \[default: true\]]' \ + '--sort-field[Field name to sort by. \[nargs=0..1\] \[default: "Reference"\]]' \ + '--string-delimiter[Character to surround fields with. \[nargs=0..1\] \[default: """\]]' \ + && return 0 +} + +_kicad_cli_sch_export_dxf() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--black-and-white -b)'{--black-and-white,-b}'[Black and white only]' \ + '--default-font[Default font name \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--draw-hop-over[Draw hop over at wire crossings]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '(--exclude-drawing-sheet -e)'{--exclude-drawing-sheet,-e}'[No drawing sheet]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--pages[List of page numbers separated by comma to print, blank or unspecified is equivalent to all pages \[nargs=0..1\] \[default: ""\]]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to schematic settings) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_sch_export_hpgl() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--black-and-white -b)'{--black-and-white,-b}'[Black and white only]' \ + '--default-font[Default font name \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--draw-hop-over[Draw hop over at wire crossings]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '(--exclude-drawing-sheet -e)'{--exclude-drawing-sheet,-e}'[No drawing sheet]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--origin -r)'{--origin,-r}'[Deprecated. Has no effect. \[nargs=0..1\] \[default: 1\]]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--pages[List of page numbers separated by comma to print, blank or unspecified is equivalent to all pages \[nargs=0..1\] \[default: ""\]]' \ + '(--pen-size -p)'{--pen-size,-p}'[Deprecated. Has no effect. \[nargs=0..1\] \[default: 0.5\]]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to schematic settings) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_sch_export_netlist() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--format[Netlist output format, valid options: kicadsexpr, kicadxml, cadstar, orcadpcb2, spice, spicemodel, pads, allegro \[nargs=0..1\] \[default: "kicadsexpr"\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_sch_export_pdf() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--black-and-white -b)'{--black-and-white,-b}'[Black and white only]' \ + '--default-font[Default font name \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--draw-hop-over[Draw hop over at wire crossings]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '(--exclude-drawing-sheet -e)'{--exclude-drawing-sheet,-e}'[No drawing sheet]' \ + '--exclude-pdf-hierarchical-links[Do not generate clickable links for hierarchical elements in PDF]' \ + '--exclude-pdf-metadata[Do not generate PDF metadata from AUTHOR and SUBJECT variables]' \ + '--exclude-pdf-property-popups[Do not generate property popups in PDF]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--no-background-color -n)'{--no-background-color,-n}'[Avoid setting a background color (regardless of theme)]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + '--pages[List of page numbers separated by comma to print, blank or unspecified is equivalent to all pages \[nargs=0..1\] \[default: ""\]]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to schematic settings) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_sch_export_ps() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--black-and-white -b)'{--black-and-white,-b}'[Black and white only]' \ + '--default-font[Default font name \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--draw-hop-over[Draw hop over at wire crossings]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '(--exclude-drawing-sheet -e)'{--exclude-drawing-sheet,-e}'[No drawing sheet]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--no-background-color -n)'{--no-background-color,-n}'[Avoid setting a background color (regardless of theme)]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--pages[List of page numbers separated by comma to print, blank or unspecified is equivalent to all pages \[nargs=0..1\] \[default: ""\]]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to schematic settings) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_sch_export_python_bom() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_sch_export_svg() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--black-and-white -b)'{--black-and-white,-b}'[Black and white only]' \ + '--default-font[Default font name \[nargs=0..1\] \[default: ""\]]' \ + '(--define-var -D)'{--define-var,-D}'[]' \ + '--draw-hop-over[Draw hop over at wire crossings]' \ + '--drawing-sheet[Path to drawing sheet, this overrides any existing project defined sheet when used \[nargs=0..1\] \[default: ""\]]' \ + '(--exclude-drawing-sheet -e)'{--exclude-drawing-sheet,-e}'[No drawing sheet]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--no-background-color -n)'{--no-background-color,-n}'[Avoid setting a background color (regardless of theme)]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '--pages[List of page numbers separated by comma to print, blank or unspecified is equivalent to all pages \[nargs=0..1\] \[default: ""\]]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to schematic settings) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_sch_upgrade() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--force[Forces the schematic file to be resaved regardless of versioning]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + && return 0 +} + +_kicad_cli_sym_commands() { + local -a commands + commands=( + 'export:Export utilities (svg)' + 'upgrade:Upgrades the symbol library to the current kicad version format' + ) + _describe -t commands 'command' commands +} +_kicad_cli_sym() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '1: :_kicad_cli_sym_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (export) + _kicad_cli_sym_export + ;; + (upgrade) + _kicad_cli_sym_upgrade + ;; + esac + ;; + esac +} + +_kicad_cli_sym_export_commands() { + local -a commands + commands=( + 'svg:Exports the symbol or entire symbol library to SVG' + ) + _describe -t commands 'command' commands +} +_kicad_cli_sym_export() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '1: :_kicad_cli_sym_export_commands' \ + '*:: :->args' \ + && return 0 + + case $state in + (args) + case $words[1] in + (svg) + _kicad_cli_sym_export_svg + ;; + esac + ;; + esac +} + +_kicad_cli_sym_export_svg() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--black-and-white[Black and white only]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '--include-hidden-fields[Include hidden fields]' \ + '--include-hidden-pins[Include hidden pins]' \ + '(--output -o)'{--output,-o}'[Output directory \[nargs=0..1\] \[default: ""\]]' \ + '(--symbol -s)'{--symbol,-s}'[Specific symbol to export within the library \[nargs=0..1\] \[default: ""\]]' \ + '(--theme -t)'{--theme,-t}'[Color theme to use (will default to symbol editor settings) \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_sym_upgrade() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--force[Forces the symbol library to be resaved regardless of versioning]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + '(--output -o)'{--output,-o}'[Output file \[nargs=0..1\] \[default: ""\]]' \ + && return 0 +} + +_kicad_cli_version() { + local context state state_descr line + typeset -A opt_args + + _arguments -C \ + '--format[version info format (plain, commit, about) \[nargs=0..1\] \[default: "plain"\]]' \ + '(--help -h)'{--help,-h}'[Shows help message and exits]' \ + && return 0 +} + + +if type compdef >/dev/null 2>&1; then + compdef _kicad_cli kicad-cli +fi diff --git a/resources/linux/autocomplete/generate_bash_completion.py b/resources/linux/autocomplete/generate_bash_completion.py new file mode 100644 index 0000000000..74450c5c1b --- /dev/null +++ b/resources/linux/autocomplete/generate_bash_completion.py @@ -0,0 +1,144 @@ +import subprocess +import json +import re +import os +import sys + +# --- Tree Generation Logic --- + +KICAD_CLI = "kicad-cli" +ENV = os.environ.copy() +ENV["KICAD_RUN_FROM_BUILD_DIR"] = "1" + +def get_help(args): + cmd = [KICAD_CLI] + args + ["-h"] + try: + result = subprocess.run(cmd, capture_output=True, text=True, env=ENV) + return result.stdout + except Exception as e: + return "" + +def parse_help(help_text): + subcommands = {} + options = {} + + lines = help_text.split('\n') + section = None + + for line in lines: + line = line.strip() + if not line: + continue + + if line.startswith("Subcommands:"): + section = "subcommands" + continue + elif line.startswith("Optional arguments:") or line.startswith("Arguments:"): + section = "options" + continue + + if section == "subcommands": + match = re.match(r'^([a-z0-9_-]+)\s+(.*)$', line) + if match: + subcommands[match.group(1)] = match.group(2).strip() + + if section == "options": + parts = re.split(r'\s{2,}', line, maxsplit=1) + flags_part = parts[0] + description = parts[1] if len(parts) > 1 else "" + + flags = re.findall(r'(-[a-zA-Z0-9]|--[a-zA-Z0-9_-]+)', flags_part) + for flag in flags: + options[flag] = description + + return subcommands, options + +def explore(path): + sys.stderr.write(f"Exploring {' '.join(path)}\n") + help_text = get_help(path) + subs_map, opts_map = parse_help(help_text) + + tree = { + "options": opts_map, + "subcommands": {}, + "subcommand_descriptions": subs_map + } + + for sub in subs_map.keys(): + tree["subcommands"][sub] = explore(path + [sub]) + + return tree + +# --- Bash Completion Generation Logic --- + +def generate_bash_completion(tree): + script = [] + script.append("# kicad-cli bash completion") + script.append("") + script.append("_kicad_cli()") + script.append("{") + script.append(" local cur prev words cword") + script.append(" if type _init_completion >/dev/null 2>&1; then") + script.append(" _init_completion || return") + script.append(" else") + script.append(" COMPREPLY=()") + script.append(" cur=\"${COMP_WORDS[COMP_CWORD]}\"") + script.append(" prev=\"${COMP_WORDS[COMP_CWORD-1]}\"") + script.append(" words=(\"${COMP_WORDS[@]}\")") + script.append(" cword=$COMP_CWORD") + script.append(" fi") + script.append("") + script.append(" local command_chain") + script.append(" command_chain=()") + script.append("") + script.append(" # Find the command chain") + script.append(" for ((i=1; i < cword; i++)); do") + script.append(" if [[ \"${words[i]}\" != -* ]]; then") + script.append(" command_chain+=(\"${words[i]}\")") + script.append(" fi") + script.append(" done") + script.append("") + script.append(" local cmd_str=\"${command_chain[*]}\"") + script.append("") + script.append(" case \"$cmd_str\" in") + + # Helper to flatten options + def get_opts(node): + opts = node.get("options", {}) + if isinstance(opts, dict): + return " ".join(sorted(opts.keys())) + return " ".join(sorted(list(set(opts)))) + + # Helper to get subcommands + def get_subs(node): + return " ".join(sorted(node.get("subcommands", {}).keys())) + + # Recursive function to generate cases + def visit(node, path): + path_str = " ".join(path) + opts = get_opts(node) + subs = get_subs(node) + + # Case for this path + script.append(f" \"{path_str}\")") + if subs: + script.append(f" COMPREPLY=( $(compgen -W \"{subs} {opts}\" -- \"$cur\") )") + else: + script.append(f" COMPREPLY=( $(compgen -W \"{opts}\" -- \"$cur\") )") + script.append(" return 0") + script.append(" ;;") + + for sub_name, sub_node in node.get("subcommands", {}).items(): + visit(sub_node, path + [sub_name]) + + visit(tree, []) + + script.append(" esac") + script.append("}") + script.append("complete -F _kicad_cli kicad-cli") + + return "\n".join(script) + +if __name__ == "__main__": + tree = explore([]) + print(generate_bash_completion(tree)) diff --git a/resources/linux/autocomplete/generate_zsh_completion.py b/resources/linux/autocomplete/generate_zsh_completion.py new file mode 100644 index 0000000000..65f0e90a50 --- /dev/null +++ b/resources/linux/autocomplete/generate_zsh_completion.py @@ -0,0 +1,202 @@ +import subprocess +import json +import re +import os +import sys + +# --- Tree Generation Logic --- + +KICAD_CLI = "kicad-cli" +ENV = os.environ.copy() +ENV["KICAD_RUN_FROM_BUILD_DIR"] = "1" + +def get_help(args): + cmd = [KICAD_CLI] + args + ["-h"] + try: + result = subprocess.run(cmd, capture_output=True, text=True, env=ENV) + return result.stdout + except Exception as e: + return "" + +def parse_help(help_text): + subcommands = {} + options = {} + + lines = help_text.split('\n') + section = None + + for line in lines: + line = line.strip() + if not line: + continue + + if line.startswith("Subcommands:"): + section = "subcommands" + continue + elif line.startswith("Optional arguments:") or line.startswith("Arguments:"): + section = "options" + continue + + if section == "subcommands": + match = re.match(r'^([a-z0-9_-]+)\s+(.*)$', line) + if match: + subcommands[match.group(1)] = match.group(2).strip() + + if section == "options": + parts = re.split(r'\s{2,}', line, maxsplit=1) + flags_part = parts[0] + description = parts[1] if len(parts) > 1 else "" + + flags = re.findall(r'(-[a-zA-Z0-9]|--[a-zA-Z0-9_-]+)', flags_part) + for flag in flags: + options[flag] = description + + return subcommands, options + +def explore(path): + sys.stderr.write(f"Exploring {' '.join(path)}\n") + help_text = get_help(path) + subs_map, opts_map = parse_help(help_text) + + tree = { + "options": opts_map, + "subcommands": {}, + "subcommand_descriptions": subs_map + } + + for sub in subs_map.keys(): + tree["subcommands"][sub] = explore(path + [sub]) + + return tree + +# --- Zsh Completion Generation Logic --- + +def escape_desc(desc): + return desc.replace("'", "'\\''").replace("[", "\\[").replace("]", "\\]") + +def generate_zsh_completion(tree): + lines = [] + lines.append("#compdef kicad-cli") + lines.append("") + + # Helper to generate function name from path + def get_func_name(path): + if not path: + return "_kicad_cli" + return "_kicad_cli_" + "_".join(path).replace("-", "_") + + all_functions = [] + + def visit(node, path): + func_name = get_func_name(path) + + current_func_lines = [] + current_func_lines.append(f"{func_name}() {{") + current_func_lines.append(" local context state state_descr line") + current_func_lines.append(" typeset -A opt_args") + current_func_lines.append("") + + # Prepare arguments list + args = [] + + # Add options + opts = node.get("options", {}) + processed_opts = set() + sorted_opts = sorted(opts.keys()) + + for opt in sorted_opts: + if opt in processed_opts: + continue + + desc = opts[opt] + pair = [] + pair.append(opt) + processed_opts.add(opt) + + for other_opt in sorted_opts: + if other_opt == opt: continue + if other_opt in processed_opts: continue + + if opts[other_opt] == desc: + pair.append(other_opt) + processed_opts.add(other_opt) + + desc_escaped = escape_desc(desc) + + if len(pair) > 1: + exclusion = " ".join(pair) + brace = ",".join(pair) + args.append(f" '({exclusion})'{{{brace}}}'[{desc_escaped}]' \\") + else: + args.append(f" '{opt}[{desc_escaped}]' \\") + + subcommands = node.get("subcommands", {}) + sub_descs = node.get("subcommand_descriptions", {}) + + sub_cmds_func = func_name + "_commands" + + if subcommands: + args.append(f" '1: :{sub_cmds_func}' \\") + args.append(" '*:: :->args' \\") + + current_func_lines.append(" _arguments -C \\") + for arg in args: + current_func_lines.append(arg) + current_func_lines.append(" && return 0") + + if subcommands: + current_func_lines.append("") + current_func_lines.append(" case $state in") + current_func_lines.append(" (args)") + current_func_lines.append(" case $words[1] in") + + for sub in sorted(subcommands.keys()): + sub_func = get_func_name(path + [sub]) + current_func_lines.append(f" ({sub})") + current_func_lines.append(f" {sub_func}") + current_func_lines.append(" ;;") + + current_func_lines.append(" esac") + current_func_lines.append(" ;;") + current_func_lines.append(" esac") + + # Define the aux function for subcommands + aux_lines = [] + aux_lines.append(f"{sub_cmds_func}() {{") + aux_lines.append(" local -a commands") + aux_lines.append(" commands=(") + for sub in sorted(subcommands.keys()): + desc = sub_descs.get(sub, "") + desc_escaped = escape_desc(desc) + aux_lines.append(f" '{sub}:{desc_escaped}'") + aux_lines.append(" )") + aux_lines.append(" _describe -t commands 'command' commands") + aux_lines.append("}") + + # Add aux function to global list + all_functions.append("\n".join(aux_lines)) + + current_func_lines.append("}") + current_func_lines.append("") + + # Add current function to global list + all_functions.append("\n".join(current_func_lines)) + + # Recurse + for sub in sorted(subcommands.keys()): + visit(subcommands[sub], path + [sub]) + + visit(tree, []) + + lines.extend(all_functions) + + lines.append("") + lines.append("if type compdef >/dev/null 2>&1; then") + lines.append(" compdef _kicad_cli kicad-cli") + lines.append("fi") + + return "\n".join(lines) + +if __name__ == "__main__": + tree = explore([]) + print(generate_zsh_completion(tree)) diff --git a/resources/linux/autocomplete/kicad-cli-completion.bash b/resources/linux/autocomplete/kicad-cli-completion.bash new file mode 100644 index 0000000000..72dd56ab4d --- /dev/null +++ b/resources/linux/autocomplete/kicad-cli-completion.bash @@ -0,0 +1,243 @@ +# kicad-cli bash completion + +_kicad_cli() +{ + local cur prev words cword + if type _init_completion >/dev/null 2>&1; then + _init_completion || return + else + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + words=("${COMP_WORDS[@]}") + cword=$COMP_CWORD + fi + + local command_chain + command_chain=() + + # Find the command chain + for ((i=1; i < cword; i++)); do + if [[ "${words[i]}" != -* ]]; then + command_chain+=("${words[i]}") + fi + done + + local cmd_str="${command_chain[*]}" + + case "$cmd_str" in + "") + COMPREPLY=( $(compgen -W "fp jobset pcb sch sym version --help --version -h -v" -- "$cur") ) + return 0 + ;; + "fp") + COMPREPLY=( $(compgen -W "export upgrade --help -h" -- "$cur") ) + return 0 + ;; + "fp export") + COMPREPLY=( $(compgen -W "svg --help -h" -- "$cur") ) + return 0 + ;; + "fp export svg") + COMPREPLY=( $(compgen -W "--black-and-white --cdnp --crossout-DNP-footprints-on-fab-layers --define-var --footprint --fp --hdnp --help --hide-DNP-footprints-on-fab-layers --layers --output --sdnp --sketch-DNP-footprints-on-fab-layers --sketch-pads-on-fab-layers --sp --theme -D -h -l -o -t" -- "$cur") ) + return 0 + ;; + "fp upgrade") + COMPREPLY=( $(compgen -W "--force --help --output -h -o" -- "$cur") ) + return 0 + ;; + "jobset") + COMPREPLY=( $(compgen -W "run --help -h" -- "$cur") ) + return 0 + ;; + "jobset run") + COMPREPLY=( $(compgen -W "--file --help --output --stop-on-error -f -h" -- "$cur") ) + return 0 + ;; + "pcb") + COMPREPLY=( $(compgen -W "drc export render upgrade --help -h" -- "$cur") ) + return 0 + ;; + "pcb drc") + COMPREPLY=( $(compgen -W "--all-track-errors --define-var --exit-code-violations --format --help --output --refill-zones --save-board --schematic-parity --severity-all --severity-error --severity-exclusions --severity-warning --units -D -h -o" -- "$cur") ) + return 0 + ;; + "pcb export") + COMPREPLY=( $(compgen -W "3dpdf brep drill dxf gencad gerber gerbers glb hpgl ipc2581 ipcd356 odb pdf ply pos ps stats step stl stpz svg u3d vrml xao --help -h" -- "$cur") ) + return 0 + ;; + "pcb export 3dpdf") + COMPREPLY=( $(compgen -W "--board-only --component-filter --cut-vias-in-body --define-var --drill-origin --fill-all-vias --force --fuse-shapes --grid-origin --help --include-inner-copper --include-pads --include-silkscreen --include-soldermask --include-tracks --include-zones --min-distance --net-filter --no-board-body --no-components --no-dnp --no-unspecified --output --subst-models --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export brep") + COMPREPLY=( $(compgen -W "--board-only --component-filter --cut-vias-in-body --define-var --drill-origin --fill-all-vias --force --fuse-shapes --grid-origin --help --include-inner-copper --include-pads --include-silkscreen --include-soldermask --include-tracks --include-zones --min-distance --net-filter --no-board-body --no-components --no-dnp --no-unspecified --output --subst-models --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export drill") + COMPREPLY=( $(compgen -W "--drill-origin --excellon-min-header --excellon-mirror-y --excellon-oval-format --excellon-separate-th --excellon-units --excellon-zeros-format --format --generate-map --generate-tenting --gerber-precision --help --map-format --output -h -o -u" -- "$cur") ) + return 0 + ;; + "pcb export dxf") + COMPREPLY=( $(compgen -W "--cdnp --check-zones --cl --common-layers --crossout-DNP-footprints-on-fab-layers --define-var --drawing-sheet --drill-shape-opt --erd --ev --exclude-refdes --exclude-value --hdnp --help --hide-DNP-footprints-on-fab-layers --ibt --include-border-title --layers --mode-multi --mode-single --ou --output --output-units --plot-invisible-text --scale --sdnp --sketch-DNP-footprints-on-fab-layers --sketch-pads-on-fab-layers --sp --subtract-soldermask --uc --udo --use-contours --use-drill-origin -D -h -l -o" -- "$cur") ) + return 0 + ;; + "pcb export gencad") + COMPREPLY=( $(compgen -W "--define-var --flip-bottom-pads --help --output --store-origin-coord --unique-footprints --unique-pins --use-drill-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export gerber") + COMPREPLY=( $(compgen -W "--cdnp --check-zones --cl --common-layers --crossout-DNP-footprints-on-fab-layers --define-var --disable-aperture-macros --drawing-sheet --erd --ev --exclude-refdes --exclude-value --hdnp --help --hide-DNP-footprints-on-fab-layers --ibt --include-border-title --layers --no-netlist --no-protel-ext --no-x2 --output --plot-invisible-text --precision --sdnp --sketch-DNP-footprints-on-fab-layers --sketch-pads-on-fab-layers --sp --subtract-soldermask --use-drill-file-origin -D -h -l -o" -- "$cur") ) + return 0 + ;; + "pcb export gerbers") + COMPREPLY=( $(compgen -W "--board-plot-params --cdnp --check-zones --cl --common-layers --crossout-DNP-footprints-on-fab-layers --define-var --disable-aperture-macros --drawing-sheet --erd --ev --exclude-refdes --exclude-value --hdnp --help --hide-DNP-footprints-on-fab-layers --ibt --include-border-title --layers --no-netlist --no-protel-ext --no-x2 --output --plot-invisible-text --precision --sdnp --sketch-DNP-footprints-on-fab-layers --sketch-pads-on-fab-layers --sp --subtract-soldermask --use-drill-file-origin -D -h -l -o" -- "$cur") ) + return 0 + ;; + "pcb export glb") + COMPREPLY=( $(compgen -W "--board-only --component-filter --cut-vias-in-body --define-var --drill-origin --fill-all-vias --force --fuse-shapes --grid-origin --help --include-inner-copper --include-pads --include-silkscreen --include-soldermask --include-tracks --include-zones --min-distance --net-filter --no-board-body --no-components --no-dnp --no-unspecified --output --subst-models --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export hpgl") + COMPREPLY=( $(compgen -W "--help --output -h -o" -- "$cur") ) + return 0 + ;; + "pcb export ipc2581") + COMPREPLY=( $(compgen -W "--bom-col-dist --bom-col-dist-pn --bom-col-int-id --bom-col-mfg --bom-col-mfg-pn --compress --define-var --drawing-sheet --help --output --precision --units --version -D -h -o" -- "$cur") ) + return 0 + ;; + "pcb export ipcd356") + COMPREPLY=( $(compgen -W "--help --output -h -o" -- "$cur") ) + return 0 + ;; + "pcb export odb") + COMPREPLY=( $(compgen -W "--compression --define-var --drawing-sheet --help --output --precision --units -D -h -o" -- "$cur") ) + return 0 + ;; + "pcb export pdf") + COMPREPLY=( $(compgen -W "--bg-color --black-and-white --cdnp --check-zones --cl --common-layers --crossout-DNP-footprints-on-fab-layers --define-var --drawing-sheet --drill-shape-opt --erd --ev --exclude-refdes --exclude-value --hdnp --help --hide-DNP-footprints-on-fab-layers --ibt --include-border-title --layers --mirror --mode-multipage --mode-separate --mode-single --negative --output --plot-invisible-text --scale --sdnp --sketch-DNP-footprints-on-fab-layers --sketch-pads-on-fab-layers --sp --subtract-soldermask --theme -D -h -l -m -n -o -t" -- "$cur") ) + return 0 + ;; + "pcb export ply") + COMPREPLY=( $(compgen -W "--board-only --component-filter --cut-vias-in-body --define-var --drill-origin --fill-all-vias --force --fuse-shapes --grid-origin --help --include-inner-copper --include-pads --include-silkscreen --include-soldermask --include-tracks --include-zones --min-distance --net-filter --no-board-body --no-components --no-dnp --no-unspecified --output --subst-models --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export pos") + COMPREPLY=( $(compgen -W "--bottom-negate-x --exclude-dnp --exclude-fp-th --format --gerber-board-edge --help --output --side --smd-only --units --use-drill-file-origin -h -o" -- "$cur") ) + return 0 + ;; + "pcb export ps") + COMPREPLY=( $(compgen -W "--black-and-white --cdnp --check-zones --cl --common-layers --crossout-DNP-footprints-on-fab-layers --define-var --drawing-sheet --drill-shape-opt --erd --ev --exclude-refdes --exclude-value --force-a4 --hdnp --help --hide-DNP-footprints-on-fab-layers --ibt --include-border-title --layers --mirror --mode-multi --mode-single --negative --output --scale --sdnp --sketch-DNP-footprints-on-fab-layers --sketch-pads-on-fab-layers --sp --subtract-soldermask --theme --track-width-correction --x-scale-factor --y-scale-factor -A -C -D -X -Y -h -l -m -n -o -t" -- "$cur") ) + return 0 + ;; + "pcb export stats") + COMPREPLY=( $(compgen -W "--exclude-footprints-without-pads --format --help --output --subtract-holes-from-board --subtract-holes-from-copper --units -h -o" -- "$cur") ) + return 0 + ;; + "pcb export step") + COMPREPLY=( $(compgen -W "--board-only --component-filter --cut-vias-in-body --define-var --drill-origin --fill-all-vias --force --fuse-shapes --grid-origin --help --include-inner-copper --include-pads --include-silkscreen --include-soldermask --include-tracks --include-zones --min-distance --net-filter --no-board-body --no-components --no-dnp --no-optimize-step --no-unspecified --output --subst-models --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export stl") + COMPREPLY=( $(compgen -W "--board-only --component-filter --cut-vias-in-body --define-var --drill-origin --fill-all-vias --force --fuse-shapes --grid-origin --help --include-inner-copper --include-pads --include-silkscreen --include-soldermask --include-tracks --include-zones --min-distance --net-filter --no-board-body --no-components --no-dnp --no-unspecified --output --subst-models --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export stpz") + COMPREPLY=( $(compgen -W "--board-only --component-filter --cut-vias-in-body --define-var --drill-origin --fill-all-vias --force --fuse-shapes --grid-origin --help --include-inner-copper --include-pads --include-silkscreen --include-soldermask --include-tracks --include-zones --min-distance --net-filter --no-board-body --no-components --no-dnp --no-optimize-step --no-unspecified --output --subst-models --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export svg") + COMPREPLY=( $(compgen -W "--black-and-white --cdnp --check-zones --cl --common-layers --crossout-DNP-footprints-on-fab-layers --define-var --drawing-sheet --drill-shape-opt --exclude-drawing-sheet --fit-page-to-board --hdnp --help --hide-DNP-footprints-on-fab-layers --layers --mirror --mode-multi --mode-single --negative --output --page-size-mode --plot-invisible-text --scale --sdnp --sketch-DNP-footprints-on-fab-layers --sketch-pads-on-fab-layers --sp --subtract-soldermask --theme -D -h -l -m -n -o -t" -- "$cur") ) + return 0 + ;; + "pcb export u3d") + COMPREPLY=( $(compgen -W "--board-only --component-filter --cut-vias-in-body --define-var --drill-origin --fill-all-vias --force --fuse-shapes --grid-origin --help --include-inner-copper --include-pads --include-silkscreen --include-soldermask --include-tracks --include-zones --min-distance --net-filter --no-board-body --no-components --no-dnp --no-unspecified --output --subst-models --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export vrml") + COMPREPLY=( $(compgen -W "--define-var --force --help --models-dir --models-relative --no-dnp --no-unspecified --output --units --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb export xao") + COMPREPLY=( $(compgen -W "--board-only --component-filter --cut-vias-in-body --define-var --drill-origin --fill-all-vias --force --fuse-shapes --grid-origin --help --include-inner-copper --include-pads --include-silkscreen --include-soldermask --include-tracks --include-zones --min-distance --net-filter --no-board-body --no-components --no-dnp --no-unspecified --output --subst-models --user-origin -D -f -h -o" -- "$cur") ) + return 0 + ;; + "pcb render") + COMPREPLY=( $(compgen -W "--background --define-var --floor --height --help --light-bottom --light-camera --light-side --light-side-elevation --light-top --output --pan --perspective --pivot --preset --quality --rotate --side --use-board-stackup-colors --width --zoom -D -h -o -w" -- "$cur") ) + return 0 + ;; + "pcb upgrade") + COMPREPLY=( $(compgen -W "--force --help -h" -- "$cur") ) + return 0 + ;; + "sch") + COMPREPLY=( $(compgen -W "erc export upgrade --help -h" -- "$cur") ) + return 0 + ;; + "sch erc") + COMPREPLY=( $(compgen -W "--define-var --exit-code-violations --format --help --output --severity-all --severity-error --severity-exclusions --severity-warning --units -D -h -o" -- "$cur") ) + return 0 + ;; + "sch export") + COMPREPLY=( $(compgen -W "bom dxf hpgl netlist pdf ps python-bom svg --help -h" -- "$cur") ) + return 0 + ;; + "sch export bom") + COMPREPLY=( $(compgen -W "--exclude-dnp --field-delimiter --fields --filter --format-preset --group-by --help --include-excluded-from-bom --keep-line-breaks --keep-tabs --labels --output --preset --ref-delimiter --ref-range-delimiter --sort-asc --sort-field --string-delimiter -h -o" -- "$cur") ) + return 0 + ;; + "sch export dxf") + COMPREPLY=( $(compgen -W "--black-and-white --default-font --define-var --draw-hop-over --drawing-sheet --exclude-drawing-sheet --help --output --pages --theme -D -b -e -h -o -t" -- "$cur") ) + return 0 + ;; + "sch export hpgl") + COMPREPLY=( $(compgen -W "--black-and-white --default-font --define-var --draw-hop-over --drawing-sheet --exclude-drawing-sheet --help --origin --output --pages --pen-size --theme -D -b -e -h -o -p -r -t" -- "$cur") ) + return 0 + ;; + "sch export netlist") + COMPREPLY=( $(compgen -W "--format --help --output -h -o" -- "$cur") ) + return 0 + ;; + "sch export pdf") + COMPREPLY=( $(compgen -W "--black-and-white --default-font --define-var --draw-hop-over --drawing-sheet --exclude-drawing-sheet --exclude-pdf-hierarchical-links --exclude-pdf-metadata --exclude-pdf-property-popups --help --no-background-color --output --pages --theme -D -b -e -h -n -o -t" -- "$cur") ) + return 0 + ;; + "sch export ps") + COMPREPLY=( $(compgen -W "--black-and-white --default-font --define-var --draw-hop-over --drawing-sheet --exclude-drawing-sheet --help --no-background-color --output --pages --theme -D -b -e -h -n -o -t" -- "$cur") ) + return 0 + ;; + "sch export python-bom") + COMPREPLY=( $(compgen -W "--help --output -h -o" -- "$cur") ) + return 0 + ;; + "sch export svg") + COMPREPLY=( $(compgen -W "--black-and-white --default-font --define-var --draw-hop-over --drawing-sheet --exclude-drawing-sheet --help --no-background-color --output --pages --theme -D -b -e -h -n -o -t" -- "$cur") ) + return 0 + ;; + "sch upgrade") + COMPREPLY=( $(compgen -W "--force --help -h" -- "$cur") ) + return 0 + ;; + "sym") + COMPREPLY=( $(compgen -W "export upgrade --help -h" -- "$cur") ) + return 0 + ;; + "sym export") + COMPREPLY=( $(compgen -W "svg --help -h" -- "$cur") ) + return 0 + ;; + "sym export svg") + COMPREPLY=( $(compgen -W "--black-and-white --help --include-hidden-fields --include-hidden-pins --output --symbol --theme -h -o -s -t" -- "$cur") ) + return 0 + ;; + "sym upgrade") + COMPREPLY=( $(compgen -W "--force --help --output -h -o" -- "$cur") ) + return 0 + ;; + "version") + COMPREPLY=( $(compgen -W "--format --help -h" -- "$cur") ) + return 0 + ;; + esac +} +complete -F _kicad_cli kicad-cli