shell_run library
Deprecated in 1.0.0. Prefer using shell in the future
Classes
- ProcessCmd
- Shell
- Multiplatform Shell utility to run a script with multiple commands.
- ShellEnvironment
- Shell modifiable helpers. should not be modified after being set.
- ShellEnvironmentAliases
- Shell environment aliases for executable
- ShellEnvironmentPaths
- Shell environment ordered paths helper. Changes the PATH variable
- ShellEnvironmentVars
- Shell environment variables helper. Does not affect the PATH variable
- ShellLinesController
- Basic shell lines controller.
- ShellOptions
- Shell options.
Extensions
- ProcessRunProcessExt on Process
- Process helper.
- ProcessRunProcessResultExt on ProcessResult
- run response helper.
-
ProcessRunProcessResultsExt
on List<
ProcessResult> - run response helper.
Constants
- dartChannelBeta → const String
- Beta channel.
- dartChannelDev → const String
- Dev channel.
- dartChannelMaster → const String
- Master channel.
- dartChannelStable → const String
- Stable channel.
Properties
- dartChannel → String
-
Current dart platform channel
no setter
- dartExecutable → String?
-
Get dart vm either from executable or using the which command
no setter
- dartVersion → Version
-
Current dart platform version
no setter
- isFlutterSupported → bool
-
no setter
- isFlutterSupportedSync → bool
-
true if flutter is supported
no setter
-
platformEnvironment
↔ Map<
String, String> -
Environment without debug VM_OPTIONS and without any user overrides
getter/setter pair
-
A shared singleton instance of
dart:io
'sstdin
stream.final -
shellEnvironment
↔ Map<
String, String> -
Cached shell environment with user config
Same as userEnvironment
getter/setter pair
- userAppDataPath → String
-
Returns the user data path
no setter
-
userEnvironment
→ Map<
String, String> -
Get the user environment
no setter
- userHomePath → String
-
Return the user home path.
no setter
-
userPaths
→ List<
String> -
Get the list of user paths used to resolve binaries location.
no setter
Functions
-
argumentsToString(
List< String> arguments) → String - Convert multiple arguments to string than can be used in a terminal
-
argumentToString(
String argument) → String - Helper to run a process and connect the input/output for verbosity
-
executableArgumentsToString(
String? executable, List< String> ? arguments) → String - Convenient way to display a command
-
getFlutterBinChannel(
) → Future< String?> - Get flutter channel. (dev, beta, master, stable)
-
getFlutterBinVersion(
) → Future< Version?> - Get flutter version.
-
processCmdToDebugString(
ProcessCmd cmd) → String -
processResultToDebugString(
ProcessResult result) → String -
prompt(
String? text, {Stream< List< ? stdin}) → Future<int> >String> - Get text
-
promptConfirm(
String? text, {Stream< List< ? stdin}) → Future<int> >bool> - Confirm action
-
promptTerminate(
) → Future - Terminate a prompt session.
-
run(
String script, {bool throwOnError = true, String? workingDirectory, Map< String, String> ? environment, bool includeParentEnvironment = true, bool? runInShell, Encoding stdoutEncoding = systemEncoding, Encoding stderrEncoding = systemEncoding, Stream<List< ? stdin, StreamSink<int> >List< ? stdout, StreamSink<int> >List< ? stderr, bool verbose = true, bool? commandVerbose, bool? commentVerbose, ShellOptions? options, void onProcess(Process process)?}) → Future<int> >List< ProcessResult> > - Run one or multiple plain text command(s).
-
runExecutableArguments(
String executable, List< String> arguments, {String? workingDirectory, Map<String, String> ? environment, bool includeParentEnvironment = true, bool? runInShell, Encoding? stdoutEncoding = systemEncoding, Encoding? stderrEncoding = systemEncoding, Stream<List< ? stdin, StreamSink<int> >List< ? stdout, StreamSink<int> >List< ? stderr, bool? verbose, bool? commandVerbose, bool? noStdoutResult, bool? noStderrResult, void onProcess(Process process)?}) → Future<int> >ProcessResult> -
if
commandVerbose
orverbose
is true, display the command. ifverbose
is true, stream stdout & stdin -
runExecutableArgumentsSync(
String executable, List< String> arguments, {String? workingDirectory, Map<String, String> ? environment, bool includeParentEnvironment = true, bool? runInShell, Encoding? stdoutEncoding = systemEncoding, Encoding? stderrEncoding = systemEncoding, StreamSink<List< ? stdout, StreamSink<int> >List< ? stderr, bool? verbose, bool? commandVerbose}) → ProcessResultint> > -
if
commandVerbose
orverbose
is true, display the command. ifverbose
is true, stream stdout & stdin -
runSync(
String script, {bool throwOnError = true, String? workingDirectory, Map< String, String> ? environment, bool includeParentEnvironment = true, bool? runInShell, Encoding stdoutEncoding = systemEncoding, Encoding stderrEncoding = systemEncoding, StreamSink<List< ? stdout, StreamSink<int> >List< ? stderr, bool verbose = true, bool? commandVerbose, bool? commentVerbose, ShellOptions? options}) → List<int> >ProcessResult> - Run one or multiple plain text command(s).
-
shellArgument(
String argument) → String - Use to safely enclose an argument if needed
-
shellArguments(
List< String> arguments) → String - Convert multiple arguments to string than can be used in a terminal
-
shellExecutableArguments(
String executable, List< String> arguments) → String - Convert executable + arguments to a single script line
-
shellStreamLines(
Stream< List< stream, {Encoding? encoding}) → Stream<int> >String> - Basic line streaming. Assuming system encoding
-
stringToArguments(
String command) → List< String> - Convert a string command to arguments.
-
userLoadEnv(
{Map< String, String> ? vars, List<String> ? paths, Map<String, String> ? aliases}) → void - Only specify the vars to override and the paths to add
-
userLoadEnvFile(
String path) → void - Update userPaths and userEnvironment
-
which(
String command, {Map< String, String> ? env, Map<String, String> ? environment, bool includeParentEnvironment = true}) → Future<String?> -
whichSync(
String command, {Map< String, String> ? env, Map<String, String> ? environment, bool includeParentEnvironment = true}) → String? -
Find the command according to the
paths
or env variables (PATH
)
Exceptions / Errors
- ShellException
- Exception thrown in exitCode != 0 and throwOnError is true