Commit Graph
21 Commits
Author SHA1 Message Date
Thomas Watson db27c446c3 Tools: remove references to removed synthetic clock flag 2026-06-21 20:02:26 -05:00
Pierre KancirandClaude Fable 5 83d9af4a54 Tools: fixes and updates for shell completion
Tools: completion: fix binary registration and vehicle-scoped completions

- _ap_bin (bash): register all SITL binaries (arducopter-heli, ardurover,
  antennatracker) instead of a duplicate arducopter entry, matching the
  zsh #compdef list.
- _ap_autotest (bash): remove the "Copter only" sed filters so test/build
  completions cover all vehicles, not just Copter.
- _ap_autotest (zsh): fix leftover debug placeholder strings in
  _wanted call for subtest completion.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: completion: sync sim_vehicle.py options with current parser

Add the many options added to sim_vehicle.py's optparse parser since
the completion scripts were last updated (build options like
--no-configure, --ubsan, --coverage; sim options like --count,
--instances, --sim-address, --enable-DDS, --osdmsp, --ekf-single,
--fram-storage, etc.) to both the bash and zsh completion scripts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: completion: sync autotest.py zsh options with current parser

Add options introduced to autotest.py's optparse parser since the
completion script was last updated (--asan, --gdb-no-tui, --ekf-single,
--replay, --force-ahrs-type, --junit, --Werror, --coverage,
--enable-dronecan-tests, etc.).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: completion: expand waf configure option completions

Add commonly used ./waf configure options (--upload*, --enable-*,
--disable-*, --ubsan*, --ekf-*, --osd*, --sitl-*, etc.) to both bash
and zsh completion scripts, keeping the two lists aligned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: completion: bring bash _ap_bin option list to parity with zsh

Add the SITL/serial options (--config, --serial0..9, --sim-address,
--base-port, etc.) already present in zsh/_ap_bin to the bash version.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: completion: generate waf command list from waf help

Parse the "Main commands" section of ./waf --help instead of
hardcoding the command list in both shells. This picks up commands
that were missing (blimp, check, check-all, replay, benchmarks,
tests, dist, install, ...) and stays current automatically. The
result is cached: per shell session in bash, via the zsh completion
cache (same policy as targets) in zsh. submodulesync and
submodule_force_clean are kept as manual entries since waf does not
list them in its help output.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: sim_vehicle: add --list-locations completion helper

Add a --list-locations option to the existing "Completion helpers"
optparse group, printing the location names from the user and
autotest locations.txt files (same lookup order as -L itself). Use
it in the bash and zsh completion scripts so -L/--location now
completes location names dynamically, like -v/--vehicle and
-f/--frame already do.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: completion: complete SITL binary -M/--model from --list-models

The SITL binaries already expose --list-models, printing the embedded
vehicleinfo.json; use it to dynamically complete -M/--model in both
the bash and zsh completion scripts, extracting the frame names with
a small python one-liner.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: completion: make bash completion scripts shellcheck-clean

Behaviour-preserving cleanups so shellcheck -x -s bash exits clean on
all bash completion scripts:

- SC2207/SC2086: build COMPREPLY with mapfile from compgen output and
  quote ${cur} instead of relying on word splitting.
- SC2199: use ${COMP_WORDS[*]} explicitly when matching the whole
  command line in _sim_vehicle frame lookup.
- SC2001: replace the echo|sed pipeline used to recover the calling
  program with the completion function's $1, which is the command.
- SC2034: drop the unused prev assignment in _ap_autotest.
- SC2155: declare and assign supported_vehicle_list separately.
- SC2006: use $(...) instead of backticks in completion.bash, and add
  shellcheck source= directives for the sourced scripts.
- SC2016 on '$(_parse_help "$1")' is intentional (compgen -W expands
  the string itself) and is now silenced with a justified directive.
- replace the seq-based word-reuse loops with C-style for loops.

Verified with shellcheck 0.9.0, bash -n/zsh -n on all scripts, and a
functional smoke test (registration plus dynamic -L, --board and
static option completion).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: completion: fix option drift against the tools' help output

Cross-checking the completion scripts against the real help output
revealed:
- waf: --enable-scripting, --disable-scripting and --disable-networking
  no longer exist (the feature toggles are the generated
  --enable-SCRIPTING/--disable-Networking build options); remove them
  from both shells.
- SITL binaries: --rtscts was removed from the binaries; --start-time,
  --sysid and --slave were never added. Sync both shells and add the
  missing -S/--synthetic-clock to the zsh script.

Also anchor the shellcheck source= directives in completion.bash with
source-path=SCRIPTDIR so shellcheck -x resolves them from any working
directory.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Tools: completion: add automated staleness checker

Add check_completions.py, which extracts the long options accepted by
waf, sim_vehicle.py, autotest.py and the SITL binaries from their help
output and compares them with the options declared in the bash and zsh
completion scripts.

Stale completion entries are always errors; options missing from the
completions are errors for sim_vehicle.py, autotest.py and the
binaries, but only warnings for waf, whose completion intentionally
offers a curated subset of the hundreds of generated build options.
Machine-facing helpers such as --list-vehicle or --list-models are
excluded via per-tool allowlists, and the binary check is skipped with
a warning when no SITL binary has been built.

The script exits non-zero on failure so it can run in CI, and already
caught real drift in the waf and SITL binary completions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-20 12:38:49 +10:00
Pierre Kancir 07dfc51267 Tools: completion: add new scripting_docs to waf 2026-06-17 14:36:22 +10:00
Joshua Henderson b42138bfb6 Tools : completion add submoduleclean & submodule_force_clean 2024-01-17 07:41:44 +11:00
Pierre Kancir e99ddb9f52 Tools: completion: fix permissions 2022-06-08 08:16:42 +09:00
Pierre Kancir fc0e2fec6b Tools: add caching for --target= completion that is long 2021-01-13 19:20:57 +11:00
Pierre Kancir 61d1f747ba Tools: completion: bash better completion for binaries 2021-01-03 12:33:25 +11:00
Pierre Kancir d52c69af81 Tools: completion: bash better completions for sim_vehicle.py 2021-01-03 12:33:25 +11:00
Pierre Kancir bee767a9aa Tools: completion: better completion for waf 2021-01-03 12:33:25 +11:00
Pierre Kancir 60f2e119a5 Tools: completion: bash complete subtest on autotest.py 2021-01-03 12:33:25 +11:00
Andrew Tridgell 895b9a34f9 Tools: support uartI, allowing a total of 9 uarts
this allows for OTG2 on the MatekH743 board, which makes SLCAN much
easier
2020-11-30 14:09:31 +11:00
Pierre Kancir aac416deb1 Tools: completion: simplify bash completion for sim_vehicle.py 2020-08-06 20:55:13 +10:00
Pierre Kancir 7292ee8ec6 Tools: completion bash: fix and simplify frames completion 2020-07-12 11:11:17 +10:00
Pierre Kancir ced185b59b Tools: Completion: fix vehicle type competion 2020-04-30 20:32:34 +10:00
Pierre Kancir 5736e28693 Tools: completion bash: correct word reuse skipping 2020-04-07 09:16:33 +10:00
Pierre Kancir 3262175f86 Tools: completion: add bash completion for autotest.py 2020-04-07 09:16:33 +10:00
Harsh Pandey 070b7c3202 Updated changes as requested in waf for shell completion 2020-02-18 10:38:56 +11:00
Pierre Kancir b247f2830b Tools: add completion for vehicle binaries 2020-01-20 18:33:06 +11:00
Pierre Kancir 1affdbf275 Tools: completion: get vehicule type from sim_vehicle help 2019-11-19 10:04:02 +11:00
Pierre Kancir 989653bf69 Tools: completion: get boards list from help 2019-11-19 10:04:02 +11:00
Pierre Kancir fce6aad00f Tools: add initial bash completion 2019-11-12 10:34:05 +11:00