From 2a5ede81df3ec082184bccfcf96a0c62f6585edd Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Sun, 22 Oct 2023 17:22:29 +0200 Subject: [PATCH] [process_run] v0.13.2 export stringToArguments --- .github/workflows/run_ci_downgrade_analyze.yml | 4 ++-- packages/process_run/CHANGELOG.md | 4 ++++ packages/process_run/lib/process_run.dart | 2 ++ packages/process_run/lib/shell.dart | 2 +- packages/process_run/lib/shell_run.dart | 2 ++ packages/process_run/lib/src/bin/shell/env.dart | 3 +-- packages/process_run/lib/src/bin/shell/env_file_content.dart | 2 +- packages/process_run/lib/src/common/dev_utils.dart | 1 + packages/process_run/lib/src/shell.dart | 5 ++--- packages/process_run/lib/src/shell_environment.dart | 5 ++--- packages/process_run/lib/src/shell_utils_common.dart | 5 +++++ packages/process_run/pubspec.yaml | 2 +- packages/process_run/test/shell_api_test.dart | 3 +++ 13 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/run_ci_downgrade_analyze.yml b/.github/workflows/run_ci_downgrade_analyze.yml index ec9230d..6f19237 100644 --- a/.github/workflows/run_ci_downgrade_analyze.yml +++ b/.github/workflows/run_ci_downgrade_analyze.yml @@ -1,4 +1,4 @@ -name: Run CI +name: Run CI Downgrade analyze on: push: pull_request: @@ -25,4 +25,4 @@ jobs: sdk: ${{ matrix.dart }} - run: dart --version - run: dart pub global activate dev_test - - run: dart pub global run dev_test:run_ci --pub-downgrade --analyze --no-override --recursive \ No newline at end of file + - run: dart pub global run dev_test:run_ci --pub-downgrade --analyze --no-override --recursive diff --git a/packages/process_run/CHANGELOG.md b/packages/process_run/CHANGELOG.md index e0b0afb..3c7ef27 100644 --- a/packages/process_run/CHANGELOG.md +++ b/packages/process_run/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.13.2 + +* Export `stringToArguments` in `shell.dart` + ## 0.13.1 * Dart 3 only diff --git a/packages/process_run/lib/process_run.dart b/packages/process_run/lib/process_run.dart index eb5fc48..7a2e416 100644 --- a/packages/process_run/lib/process_run.dart +++ b/packages/process_run/lib/process_run.dart @@ -1,6 +1,8 @@ /// /// Helper to run a process and connect the input/output for verbosity /// +library; + export 'package:process_run/src/shell_utils_common.dart' show argumentsToString, argumentToString; diff --git a/packages/process_run/lib/shell.dart b/packages/process_run/lib/shell.dart index a800b98..65ce319 100644 --- a/packages/process_run/lib/shell.dart +++ b/packages/process_run/lib/shell.dart @@ -36,7 +36,7 @@ export 'package:process_run/src/shell_utils.dart' shellArguments, shellExecutableArguments; export 'package:process_run/src/shell_utils_common.dart' - show argumentsToString, argumentToString; + show argumentsToString, argumentToString, stringToArguments; export 'package:process_run/src/user_config.dart' show userPaths, userEnvironment, userLoadEnvFile, userLoadEnv; diff --git a/packages/process_run/lib/shell_run.dart b/packages/process_run/lib/shell_run.dart index e9fd2b5..69104e1 100644 --- a/packages/process_run/lib/shell_run.dart +++ b/packages/process_run/lib/shell_run.dart @@ -1,2 +1,4 @@ /// Deprecated in 1.0.0. Prefer using shell in the future +library; + export 'shell.dart'; diff --git a/packages/process_run/lib/src/bin/shell/env.dart b/packages/process_run/lib/src/bin/shell/env.dart index 1a8ea54..ad5ab9c 100644 --- a/packages/process_run/lib/src/bin/shell/env.dart +++ b/packages/process_run/lib/src/bin/shell/env.dart @@ -16,8 +16,7 @@ import 'env_var.dart'; import 'import.dart'; class ShellEnvCommandBase extends ShellBinCommand { - ShellEnvCommandBase({required String name, String? description}) - : super(name: name, description: description) { + ShellEnvCommandBase({required super.name, super.description}) { parser.addFlag(flagLocal, abbr: 'l', help: 'Use local env', negatable: false, defaultsTo: true); parser.addFlag(flagUser, diff --git a/packages/process_run/lib/src/bin/shell/env_file_content.dart b/packages/process_run/lib/src/bin/shell/env_file_content.dart index 4b0cfaf..54fa815 100644 --- a/packages/process_run/lib/src/bin/shell/env_file_content.dart +++ b/packages/process_run/lib/src/bin/shell/env_file_content.dart @@ -96,7 +96,7 @@ class FileContent { } class EnvFileContent extends FileContent { - EnvFileContent(String path) : super(path); + EnvFileContent(super.path); bool addAlias(String alias, String command) => writeKeyValue(userConfigAliasKeys, alias, value: command); diff --git a/packages/process_run/lib/src/common/dev_utils.dart b/packages/process_run/lib/src/common/dev_utils.dart index 93a05e4..24e34da 100644 --- a/packages/process_run/lib/src/common/dev_utils.dart +++ b/packages/process_run/lib/src/common/dev_utils.dart @@ -1,4 +1,5 @@ /// Development helpers to generate warning in code +library; void _devPrint(Object object) { if (_devPrintEnabled) { diff --git a/packages/process_run/lib/src/shell.dart b/packages/process_run/lib/src/shell.dart index 2b6ea08..65322af 100644 --- a/packages/process_run/lib/src/shell.dart +++ b/packages/process_run/lib/src/shell.dart @@ -495,9 +495,8 @@ abstract class Shell implements ShellCore { class _ProcessCmd extends ProcessCmd { final String executableShortName; - _ProcessCmd(String executable, List arguments, - {required this.executableShortName}) - : super(executable, arguments); + _ProcessCmd(String super.executable, super.arguments, + {required this.executableShortName}); @override String toString() => diff --git a/packages/process_run/lib/src/shell_environment.dart b/packages/process_run/lib/src/shell_environment.dart index f751de3..7813a39 100644 --- a/packages/process_run/lib/src/shell_environment.dart +++ b/packages/process_run/lib/src/shell_environment.dart @@ -21,8 +21,7 @@ class ShellEnvironment extends common.ShellEnvironmentBase { /// It is recommended that you apply the environment to a shell. But it can /// also be set globally (be aware of the potential effect on other part of /// your application) to [shellEnvironment] - ShellEnvironment({Map? environment}) - : super.fromEnvironment(environment: environment); + ShellEnvironment({super.environment}) : super.fromEnvironment(); /// From a run start content, includeParentEnvironment should later be set /// to false @@ -50,7 +49,7 @@ class ShellEnvironment extends common.ShellEnvironmentBase { /// /// Mainly used for testing as it is not easy to which environment variable /// are required. - ShellEnvironment.fromJson(Map? map) : super.fromJson(map); + ShellEnvironment.fromJson(super.map) : super.fromJson(); /// Find a [command] path location in the environment String? whichSync(String command) { diff --git a/packages/process_run/lib/src/shell_utils_common.dart b/packages/process_run/lib/src/shell_utils_common.dart index 03db617..979f269 100644 --- a/packages/process_run/lib/src/shell_utils_common.dart +++ b/packages/process_run/lib/src/shell_utils_common.dart @@ -6,6 +6,7 @@ import 'dart:convert'; import 'package:process_run/src/platform/platform.dart'; import 'characters.dart'; +import 'shell_utils.dart' as shell_utils; const windowsDefaultPathExt = ['.exe', '.bat', '.cmd', '.com']; @@ -86,3 +87,7 @@ String shellArgument(String argument) => argumentToString(argument); /// Convert multiple arguments to string than can be used in a terminal String shellArguments(List arguments) => argumentsToString(arguments); + +/// Convert a string command to arguments. +List stringToArguments(String command) => + shell_utils.shellSplit(command); diff --git a/packages/process_run/pubspec.yaml b/packages/process_run/pubspec.yaml index a0cc971..54abe17 100644 --- a/packages/process_run/pubspec.yaml +++ b/packages/process_run/pubspec.yaml @@ -1,5 +1,5 @@ name: process_run -version: 0.13.1 +version: 0.13.2 description: Process run helpers for Linux/Win/Mac and which like feature for finding executables. homepage: https://github.com/tekartik/process_run.dart/blob/master/packages/process_run diff --git a/packages/process_run/test/shell_api_test.dart b/packages/process_run/test/shell_api_test.dart index d203995..f6f58d7 100644 --- a/packages/process_run/test/shell_api_test.dart +++ b/packages/process_run/test/shell_api_test.dart @@ -53,6 +53,9 @@ void main() { ProcessCmd; processResultToDebugString; processCmdToDebugString; + + // shell_utils + stringToArguments; }); }); }