Expand description
The directive protocol: how the binary changes the state of the wrapped shell.
A process cannot change the working directory or the environment of its parent. Instead the
binary writes directives to its own stderr, and the shellgame shell function
(bash.sh, fish.fish) replays them in the player’s shell after the binary has exited.
__SHELLGAME_EXEC__v1 <verb>[ <base64 argument>...]| verb | arguments | effect in the shell |
|---|---|---|
cd | destination | change directory, bypassing the player-facing cd |
export | name, value | set and export one variable (^[A-Za-z_][A-Za-z0-9_]*$) |
echo | message | print one line |
pwd | none | print the working directory |
exit | none | close the game shell |
Every argument is standard, padded base64 of the raw bytes, so spaces and shell metacharacters never reach a shell parser. Lines end in LF. Unknown versions, verbs and argument counts are ignored by the shell, and there is no way to run arbitrary commands.
Directives is the typed emitter used by the game; encode is the pure encoder behind it.
Structs§
- Directives
- Emits directives for the wrapper shell, or does nothing when the binary runs outside of it.
- Invalid
Name - An environment variable name that the shell would refuse to export.
Constants§
- PREFIX
- Marker that starts every directive line. Anything else on stderr is plain output.
- VERSION
- Protocol version, written right after
PREFIX.
Functions§
- encode
- Encodes one directive line, without the trailing newline.