Skip to main content

Module cli

Module cli 

Source
Expand description

The contract on the command line: shuyi <op> [args] [--json]. Each op’s arguments become its input, its answer is printed for people or, with --json, as one JSON document (Answer::to_json). An error carries a problem code (codes), and the exit code is 0 if it passed, 1 if not, 2 for wrong arguments (SH0nnn), and 3 for a setup to fix before running it again (SH1nnn: no project, a project file that lacks what it needs, the toolchain).

new, doctor, explain, attach and schema need no project. lint, modules and add run on the project, not its game. The others run on the project’s game, in its tool program; import without one reads only the engine’s standard kinds.

Functions§

check_targets
check --target with args on project, with the game’s tools game if they are at hand.
checks_targets
Whether op name with args checks targets (check --target, and export, which starts with that check), which runs on the project file alone, without the game’s tools.
export
export with args on project, with the game’s tools game if they are at hand (for its check’s controls).
import
import with args (no --json) by importers, from root, with limit added to its answer if it is given.
lint
lint with args on project, running cargo with cargo.
modules_or_add
modules or add (name) with args on project: on its files, not its game.
no_game
Says that command name (one that runs the game) can’t run with args: the project names no game tool program (codes::PROJECT_FILE). The exit code is 3.
runs_the_game
Whether name is an op that runs on the project’s game.
setup_failed
Says that command name can’t run with args: its setup is wrong (error, of setup code code). An op with --json answers a failed Answer; anything else says it for people. Returns the code’s exit code, 3.
split_json
Whether args ask for JSON, and the rest of them.
with_game
Runs op name (one that runs_the_game) with args on project’s game.
without_project
Runs name with args if it is an op that needs no project (new, doctor, explain, attach, schema, and mcp, which finds a project per call), in the working folder cwd; None if it isn’t.