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.
| Command | What it does | Page |
|---|---|---|
serve | Start the language server. Editors do this for you, see the editor setup. | editors |
lint | Run clang-tidy over every translation unit with a worker pool. | lint |
index | Index a project ahead of time so the server starts warm. | index |
format | Format the project's files with clang-format. | format |
inspect | Run one feature on a source file and print the raw result as JSON. | |
command | Show the commands a file compiles with, and convert compile commands for other tools. | command |
query | Ask the persisted index about symbols, references, call graphs and files. | query |
refactor | Rename a symbol across the project from the persisted index. | refactor |
analyze | Report facts for refactoring, such as module dependencies and cycles. | analyze |
modularize | Wrap third-party libraries as C++20 modules, rewrite the program into module units. | modularize |
scan | Scan 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 indexindexes,clice analyze modulesgives the overview,clice command <file>shows the file's commands.--helpafter 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 aclice.toml, a.clice/config.tomlor acompile_commands.json, directly or in itsbuild/directory, else the current directory itself (inspectlooks 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 filesindex,lintandformatwork on at once;CLICE_LOG_LEVELin the environment sets what is logged to stderr, warnings and errors by default (serve, whose stderr an editor shows, frominfo); the session logs ofserve,indexandlintkeepinfowhatever it is.
Exit codes
Every command ends with one of four exit codes, which its page details:
| Code | Meaning |
|---|---|
0 | The command did what it was asked. |
1 | It 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. |
2 | It 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. |
130 | It was interrupted. |
