# Kubos CLI Command Reference¶

The kubos command is always run with a subcommand in order to do something, kubos with no subcommand will only display help information.

## Command Overview¶

Command Function
build Build the current module.
clean Remove files created by kubos and the build.
config Display the target configuration info.
debug Attach a debugger to the current target. Requires target support.
flash Launch the compiled program (available for executable modules only). Requires target support for cross-compiling targets.
flash (KubOS Linux Targets) Load files onto target.
init Create a new module.
list List the dependencies of the current module, or the inherited targets of the current target.
target Set or display the target device.
test Run the tests for the current module on the current target. Requires target support for cross-compiling targets
version Display the current active version of the CLI and Kubos source repo.
versions Display the available versions of the KubOS source.
use Set a new version of the Kubos modules to build your projects against.

## kubos build¶

### Synopsis¶

$kubos build [--generate-only] [--debug-build] [--cmake-generator <cmake-generator-name>] [name ... ]$ kubos build [ ... ] -- [ build-tool arguments ]


### Description¶

Build the current module and its dependencies.

Kubos uses CMake to control the build, the basic process is:

• kubos generates CMakeLists.txt describing the libraries and executables to build
• kubos instructs CMake to generate the make files / ninja files / IDE project file (depending on –cmake-generator)
• kubos instructs CMake to execute the build. The compiler used depends on the CMake Toolchain file provided by the active kubos target.

### Options¶

• --generate-only, -g: only generate the CMakeLists, don’t build
• --debug-build, -d: build a debug (less-optimized) build. The effects depend on the target (this selects CMake build type Debug), but generally this means no optimization, and NDEBUG is not defined.
• --release-build, -r: build a release (optimized) build. deprecated The effects depend on the target (this selects CMake build type RelWithDebInfo). This option is deprecated because it is now the default, unless –debug-build is specified.
• --cmake-generator, -G: specify the CMake Generator. CMake can generate project files for various editors and IDEs.
• name ...: one or more modules may be specified, in which case only these modules and their dependencies will be built. Use all_tests to cause all tests to be built.
• -- ...: any options specified after – are passed unmodified on to the tool being used for building (e.g. Ninja, or make)

## kubos init¶



### Description¶

Delete the ‘build’ subdirectory of a project. This will remove all remaining artifacts and generated files from previous builds.

## kubos test¶

$kubos test [--list] [--no-build] [ build-arguments ] [tests-to-run ...]  ### Description¶ Run tests. If no arguments are specified, then the tests for the current module will be run, use kubos test all to run the tests for all modules. The target description provides support for the test command if it is a cross-compiling target (no support is necessary to run tests natively). The scripts.test value in the target description is executed with $program expanded to the path to the binary, it should be a wrapper script that loads the binary at the specified path onto the target device, runs it, and prints output on standard output.

Options:

• --list, -l List the tests that would be run, rather than running them. Implies --no-build.
• --no-build, -n Don’t build anything. Try to run already-built tests. Things will fail if all the specified tests are not built!
• This command also accepts the options to kubos_build, which are used if building.

### Examples¶

$kubos test$ kubos test --list all
$kubos test -n my-test$ kubos test --config="path/to/test-config.json"


## kubos debug¶

$kubos debug  ### Description¶ If the target description supports it, launch a debugger attached to the specified executable. ## kubos target¶ ### Synopsis¶ $ kubos target
$kubos target <targetname>$ kubos target --list, -l


### Description¶

Display or set the current target.

Targets define the options and commands that kubos uses to compile modules and executables.

A target must define a CMake Toolchain file describing all of the rules that kubos uses to build software, it may also define commands to launch a debugger (used by kubos debug).

### Options¶

• --list, -l List all of the available Kubos targets.



### Description¶

Flash the build of the current target to the target board.

Note: This requires target support.

## kubos flash (KubOS Linux targets)¶

Synonyms: kubos start



### Description¶

Display the current version of the Kubos CLI, and the Kubos modules

### Options¶

• --list, -l List the available Kubos source versions

## kubos versions¶



### Description¶

List the licenses of all of the modules that the current module depends on. If --all is specified, then each unique license is listed for each module it occurs in, instead of just once.

NOTE: while kubos can list the licenses that modules have declared in their module.json files, it can make no warranties about whether modules contain code under other licenses that have not been declared.

## kubos config¶

### Synopsis¶

\$ kubos config


### Description¶

Display the merged config data for the current target (and application, if the current module defines an executable application).

The config data is produced by merging the json config data defined by the application, the current target, and any targets the current target inherits from recursively. Values defined by the application will override those defined at the same path by targets, and values defined in targets will override values defined by targets they inherit from.

The config data displayed is identical to the data that will be available to modules when they are built.