utils
library
Classes
-
Definition
-
A typical script definition.
-
Info
-
Package information which includes
package name & version with both being String.
-
Pubspec
-
A singleton class that reads and caches the content of
pubspec.yaml in current directory and provides utilities
for .
-
Reference
-
A helper class to represent a reference to a script.
-
ScriptsRegistry
-
A class that holds scripts and provides utilities
to work with them.
Properties
-
currentPlatformKey
→ String?
-
Returns the metadata key for the current OS, or
null on unsupported platforms.
no setter
Functions
-
applyPositionalArgs(String script, List<String> args)
→ MapEntry<String, List<String>>
-
Replaces
$1, $2, etc. in script with positional args from args.
-
assertShellInert(String value, String describe)
→ void
-
Throws a FormatException if
value carries a shell-active character.
-
collectVariables(JsonMap map)
→ Map<String, String>
-
Collects all variable definitions from
map by scanning for (variables)
sections at every nesting level. Later definitions override earlier ones.
-
readYamlMap(String filePath)
→ Future<Map>
-
Reads and returns a yaml file if exists and
if the content is a map.
-
rejectRest(ArgResults argResults, String usage)
→ void
-
Throws a
UsageException when argResults carries positional arguments a
command takes no meaning from.
-
runnableScripts(Map map)
→ dynamic
-
Returns the value that makes
map directly runnable on the current
platform, or null if it only holds nested command groups and metadata.
-
shellChangeDirectory(String workdir)
→ String
-
Builds a shell command that changes to
workdir before continuing.
-
shellQuote(String arg)
→ String
-
Quotes
arg so the shell passes it through as a single argument.
-
shellSplit(String input)
→ List<String>
-
Splits a shell command tail into the words the shell would pass as
arguments, so
--message "hello world" becomes two words rather than
three.
-
substituteVariables(String script, Map<String, String> variables)
→ String
-
Replaces
${VAR} tokens in script using variables first, then
Platform.environment as fallback. Unknown variables are left unchanged.