Expand description
The text checks and the console helpers the gadk commands print with. The flag-usage
helper lives in gadk-launcher as flag_usage (the launcher’s user).
Structs§
- Printer
- The step printer
log_start_stopbuilds. The arguments of one call arrive as one list, so a line is, a green>and a reset, a space, then[, the arguments’ text joined by single spaces, and]. - Reprintable
Stream - Forwards a child’s output to
stream, writingprefixfirst and in place of every newline, so each output line is indented under the step.
Constants§
- BLUE
- ANSI escape: blue foreground.
- CYAN
- ANSI escape: cyan foreground.
- GRAY
- ANSI escape: gray foreground (SGR 37).
- GREEN
- ANSI escape: green foreground.
- MAGENTA
- ANSI escape: magenta foreground.
- RED
- ANSI escape: red foreground.
- RESET
- ANSI escape: resets all attributes.
- WHITE
- ANSI escape: bright white foreground.
- YELLOW
- ANSI escape: yellow foreground.
Functions§
- center_
string spadded with spaces to widthw, the extra space on the right;wcounts bytes.- log_
command - Prints
Running : <dir> <cmd>(yellowRunning :, the directory, a reset, a space and the command), then runscmdwith its stdout and stderr each through aReprintableStreamonto the printer’s writer (both go to the command’s stdout). A failed start is its error text; a non-zero exit isexit status <n>. - log_
start_ stop - Prints
<msg> : Starting, runscommandwith aPrinter, prints an empty line, then<msg> : Finished successfullyor<msg> : Finished with errorandError: <err>, and returnscommand’s result. - new_
reprintable_ stream - Builds a stream over
s: the prefix is"\n " + color + prefix + " > " + Reset. - strip_
extension pwithout its extension, which must beexpected.- validate_
dockerfile_ safe - Rejects
",`,\, every C0 control byte and invalid UTF-8, so a value embedded in a generated Dockerfile’s exec-formCMDkeeps the line a valid JSON array and reaches the container unchanged. The weaker of the two checks; a value that reaches aRUNline needsvalidate_shell_arg_safe. - validate_
shell_ arg_ safe - Admits only letters, digits,
.,/,-,_and non-ASCII runes (valid UTF-8), the check for a value reaching a shell-formRUNline or aCOPYoperand.