[SBS] Rework CLI interface with subcommands
Overview
Replace the CLI interface of the SBS script with a subcommand-based one.
-
flash | build | format | lint | format ...
subcommands - Possibility of having per-subcommand flags (e.g.
-d
for debug builds on flash and build subcommands) - Installation functionality for autocompletion only
-
list
subcommand for querying information for use in the autocompletion scripts (e.g. listing available targets)
Subcommands
-
flash
: Build and flash a specific target. -
build
: Build a specific target. -
test
: Build a specific test on the host and run it. -
clean
: Clean the build directory. -
lint
: Lints the source code. -
format
: Formats the source code withclang-format
. -
install
: Installs autocompletion files. -
uninstall
: Uninstalls autocompletion files. -
list
: Lists available targets/boards.
Subcommands Description
flash [-d | --debug] [-v | --verbose] [-j | --jobs <n>] [-r | --reset] [--] <target>
-
-d
,--debug
: Debug build (release by default). -
-v
,--verbose
: Print verbose output. -
-j
,--jobs
: Specifies the number of jobs (commands) to run simultaneously. Defaults to unset. -
-r
,--reset
: Forces flashing under reset. Provides the--connect-under-reset
flag to the st-flash utility only (useful when the board gets stuck and can't flash). -
--
: Manually stops parsing flags and starts evaluating positional arguments.
build [-d | --debug] [-v | --verbose] [-j | --jobs <n>] [--] <target>
-
-d
,--debug
: Debug build (release by default). -
-v
,--verbose
: Print verbose output. -
-j
,--jobs
: Specifies the number of jobs (commands) to run simultaneously. Defaults to unset. -
--
: Manually stops parsing flags and starts evaluating positional arguments.
test [-d | --debug] [-v | --verbose] [-j | --jobs <n>] [--] <target>
-
-d
,--debug
: Debug build (release by default) -
-j
,--jobs
: Specifies the number of jobs (commands) to run simultaneously. Defaults to unset. -
--
: Manually stops parsing flags and starts evaluating positional arguments.
clean
Should only delete the build directory, should not invoke CMake in any way: rm -r build/
.
lint
Equivalent to the current -n
option, runs all linting steps (clang-format too) but doesn't edit any files.
format
Only formats the source code, editing files in-place. Does NOT run all other linting steps. Similar to the old -e
option.
list <targets|boards>
Lists all available targets or boards. Should only output a list of strings, with no other decorator or description of the output, for use in other scripts.
Edited by Niccolò Betto