Skip to content

Command Line Overview ​

clice is one binary. Editors launch clice serve and talk to it over LSP; the other subcommands drive the same engine from a terminal, sharing its compilation database handling, caches and index.

CommandWhat it doesPage
serveStart the language server. Editors do this for you, see the editor setup.editors
lintRun clang-tidy over every translation unit with a worker pool.lint
indexIndex a project ahead of time so the server starts warm.index
formatFormat the project's files with clang-format.format
inspectRun one feature on a source file and print the raw result as JSON.
commandShow the commands a file compiles with, and convert compile commands for other tools.command
queryAsk the persisted index about symbols, references, call graphs and files.query
refactorRename a symbol across the project from the persisted index.refactor
analyzeReport facts for refactoring, such as module dependencies and cycles.analyze
modularizeWrap third-party libraries as C++20 modules, rewrite the program into module units.modularize
scanScan the include and module dependencies of the build, and time the scan.scan

inspect has no page: clice inspect --help documents its operations and options.

Arguments ​

Every subcommand takes its arguments the same way:

clice <command> [<operation>] [<target>...] [--option...]
  • A command that does several things names the one to do by a word after it: clice query references, clice index stats, clice analyze modules edge. A command whose own job comes first runs it when no word follows: clice index indexes, clice analyze modules gives the overview, clice command <file> shows the file's commands. --help after any command or operation lists what it takes.
  • The target, the symbol or file an operation is about, follows the operation: clice query references "shapes::Circle::area", clice query document-symbols src/main.cpp. A symbol is named by a locator wherever one is taken; a file by its path, relative to the current directory or absolute, as is every other path on the command line, such as a partition or an output directory.
  • Options come after the operation. An option takes several values by being repeated: --scope 'src/**' --scope 'include/**'.
  • --workspace <dir> names the project root; without it a command works on the project above the current directory, as git finds its repository: the nearest directory holding a clice.toml, a .clice/config.toml or a compile_commands.json, directly or in its build/ directory, else the current directory itself (inspect looks up from the file, as the editor does). A configuration the command cannot take — a file that does not parse, a value of the wrong type, an option it cannot honor — fails it with exit code 2, each problem named with its place in the file; --configuration <tag> pins the build configuration over the selection persisted from the editor (see build configurations); -j, --jobs <n> is how many units or files index, lint and format work on at once; CLICE_LOG_LEVEL in the environment sets what is logged to stderr, warnings and errors by default (serve, whose stderr an editor shows, from info); the session logs of serve, index and lint keep info whatever it is.

Exit codes ​

Every command ends with one of four exit codes, which its page details:

CodeMeaning
0The command did what it was asked.
1It did it, and the answer is negative: lint findings, a file to format, a symbol or file not found, a rename conflict, a unit that failed to index.
2It could not do it: the arguments or the configuration do not parse, there is nothing to work on (no project, no compilation database, no unit), the index cannot be opened.
130It was interrupted.