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.
This commit is contained in:
Seth Hillbrand
2025-12-01 13:54:15 -08:00
parent 83d3f65458
commit e42cb911b8
5 changed files with 2007 additions and 0 deletions
+13
View File
@@ -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)
File diff suppressed because it is too large Load Diff
@@ -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))
@@ -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))
@@ -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