proxy.golang.org : github.com/veggiemonk/rsc-script
Package script implements a small, customizable, platform-agnostic scripting language. Scripts are run by an Engine configured with a set of available commands and conditions that guard those commands. Each script has an associated working directory and environment, along with a buffer containing the stdout and stderr output of a prior command, tracked in a State that commands can inspect and modify. The default commands configured by NewEngine resemble a simplified Unix shell. Each line of a script is parsed into a sequence of space-separated command words, with environment variable expansion within each word and # marking an end-of-line comment. Additional variables named ':' and '/' are expanded within script arguments (expanding to the value of os.PathListSeparator and os.PathSeparator respectively) but are not inherited in subprocess environments. Adding single quotes around text keeps spaces in that text from being treated as word separators and also disables environment variable expansion. Inside a single-quoted block of text, a repeated single quote indicates a literal single quote, as in: A line beginning with # is a comment and conventionally explains what is being done or tested at the start of a new section of the script. Commands are executed one at a time, and errors are checked for each command; if any command fails unexpectedly, no subsequent commands in the script are executed. The command prefix ! indicates that the command on the rest of the line (typically go or a matching predicate) must fail instead of succeeding. The command prefix ? indicates that the command may or may not succeed, but the script should continue regardless. The command prefix [cond] indicates that the command on the rest of the line should only run when the condition is satisfied. A condition can be negated: [!root] means to run the rest of the line only if the user is not root. Multiple conditions may be given for a single command, for example, '[linux] [amd64] skip'. The command will run if all conditions are satisfied. Package script is particularly good for writing tests. Ironically, it has no tests.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/veggiemonk/rsc-script
License: BSD-3-Clause
Latest release: 8 days ago
Namespace: github.com/veggiemonk
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 8 days ago