-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[process_run] v1.2.0-0 export ShellBinCommand
- Loading branch information
1 parent
7dc8aee
commit c41a02b
Showing
22 changed files
with
193 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
## 1.2.0-0 | ||
|
||
* Export ShellBinCommand | ||
* requires dart 3.5 | ||
|
||
## 1.1.0 | ||
|
||
* Remove deprecated methods | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:path/path.dart'; | ||
import 'package:process_run/src/user_config.dart'; | ||
|
||
import 'import.dart'; | ||
|
||
/// pub run process_run:shell run | ||
class ShellEnvInfoCommand extends ShellBinCommand { | ||
/// pub run process_run:shell run | ||
ShellEnvInfoCommand() | ||
: super(name: 'info', description: 'Display environment info'); | ||
|
||
@override | ||
void printUsage() { | ||
stdout.writeln('Run a command'); | ||
stdout.writeln(); | ||
stdout.writeln('Usage: $script env info'); | ||
stdout.writeln(' Environment information'); | ||
|
||
super.printUsage(); | ||
} | ||
|
||
@override | ||
FutureOr<bool> onRun() async { | ||
void displayInfo(String title, String path) { | ||
var config = loadFromPath(path); | ||
stdout.writeln('# $title'); | ||
stdout.writeln('file: ${relative(path, from: Directory.current.path)}'); | ||
stdout.writeln('vars: ${config.vars}'); | ||
stdout.writeln('paths: ${config.paths}'); | ||
} | ||
|
||
displayInfo('user_env', getUserEnvFilePath()!); | ||
displayInfo('local_env', getLocalEnvFilePath()); | ||
|
||
return true; | ||
} | ||
} | ||
|
||
/// Direct shell env Alias dump run helper for testing. | ||
Future<void> main(List<String> arguments) async { | ||
await ShellEnvInfoCommand().parseAndRun(arguments); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'package:process_run/src/mixin/shell_bin.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/process_run/test/bin/compiled_bin_shell_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
@TestOn('vm') | ||
library process_run.test.bin.shell_bin_test; | ||
|
||
import 'package:process_run/shell.dart'; | ||
import 'package:process_run/src/bin/shell/import.dart'; | ||
import 'package:pub_semver/pub_semver.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
import '../src/compile_shell.dart'; | ||
|
||
void main() { | ||
late Shell shell; | ||
group('compiled_bin_shell', () { | ||
setUpAll(() async { | ||
var dsExePath = await compileShellBin(force: false); | ||
shell = Shell( | ||
environment: ShellEnvironment()..aliases['ds'] = dsExePath, | ||
verbose: false); | ||
}); | ||
test('version', () async { | ||
var output = (await shell.run('ds --version')).outText.trim(); | ||
await shell.run('ds env edit -h'); | ||
expect(Version.parse(output), shellBinVersion); | ||
}); | ||
group('env', () { | ||
group('path', () { | ||
test('user prepend', () async { | ||
var dummyPath = 'dummyUserPathPrepend'; | ||
await shell.run('ds env --user path delete $dummyPath'); | ||
var lines = (await shell.run('ds env --user path dump')).outLines; | ||
expect(lines, isNot(contains(dummyPath))); | ||
await shell.run('ds env --user path prepend $dummyPath'); | ||
lines = (await shell.run('ds env --user path dump')).outLines; | ||
expect(lines, contains(dummyPath)); | ||
await shell.run('ds env --user path delete $dummyPath'); | ||
lines = (await shell.run('ds env --user path dump')).outLines; | ||
expect(lines, isNot(contains(dummyPath))); | ||
}); | ||
test('local prepend', () async { | ||
var dummyPath = 'dummyLocalPathPrepend'; | ||
await shell.run('ds env --user path delete $dummyPath'); | ||
var lines = (await shell.run('ds env --user path dump')).outLines; | ||
expect(lines, isNot(contains(dummyPath))); | ||
await shell.run('ds env --user path prepend $dummyPath'); | ||
lines = (await shell.run('ds env --user path dump')).outLines; | ||
expect(lines, contains(dummyPath)); | ||
await shell.run('ds env --user path delete $dummyPath'); | ||
lines = (await shell.run('ds env --user path dump')).outLines; | ||
expect(lines, isNot(contains(dummyPath))); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.