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 --targetwithargsonproject, with the game’s toolsgameif they are at hand.- checks_
targets - Whether op
namewithargschecks targets (check --target, andexport, which starts with that check), which runs on the project file alone, without the game’s tools. - export
exportwithargsonproject, with the game’s toolsgameif they are at hand (for its check’s controls).- import
importwithargs(no--json) byimporters, fromroot, withlimitadded to its answer if it is given.- lint
lintwithargsonproject, running cargo withcargo.- modules_
or_ add modulesoradd(name) withargsonproject: on its files, not its game.- no_game
- Says that command
name(one that runs the game) can’t run withargs: the project names no game tool program (codes::PROJECT_FILE). The exit code is 3. - runs_
the_ game - Whether
nameis an op that runs on the project’s game. - setup_
failed - Says that command
namecan’t run withargs: its setup is wrong (error, of setup codecode). An op with--jsonanswers a failedAnswer; anything else says it for people. Returns the code’s exit code, 3. - split_
json - Whether
argsask for JSON, and the rest of them. - with_
game - Runs op
name(one thatruns_the_game) withargsonproject’sgame. - without_
project - Runs
namewithargsif it is an op that needs no project (new,doctor,explain,attach,schema, andmcp, which finds a project per call), in the working foldercwd;Noneif it isn’t.