Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kseo/command_wrapper
Make it easy to create a Dart wrapper for command line tools.
https://github.com/kseo/command_wrapper
Last synced: 27 days ago
JSON representation
Make it easy to create a Dart wrapper for command line tools.
- Host: GitHub
- URL: https://github.com/kseo/command_wrapper
- Owner: kseo
- License: bsd-3-clause
- Created: 2016-10-20T07:56:44.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-21T04:35:48.000Z (about 8 years ago)
- Last Synced: 2023-08-20T21:36:13.399Z (about 1 year ago)
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/command_wrapper
- Size: 7.81 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# command_wrapper
command_wrapper package makes it easy to create a Dart wrapper for command line tools.
## Usage
`CommandWrapper` lets you create a Dart wrapper for command line tools. For
example, you can create a wrapper for `curl` by passing the executable name to
the `CommandWrapper` constructor. The path of `curl` is autmatically located in a
platform independent manner using [which][which] package.[which]: https://pub.dartlang.org/packages/which
```dart
CommandWrapper curl = new CommandWrapper('curl');
CommandResult result = await curl.run(['--version']);
````CommandResult` contains `stdout`, `stderr` and `exitCode`. The type of `stdout`
and `stderr` is `List` so you can easily process each line.## Command
command_wrapper provides wrappers for commonly used Dart commands.
* dart
* pub
* dart2js
* dartfmt
* dartanalyzer
* dartdoc## Examples
```dart
import 'package:command_wrapper/command_wrapper.dart';main() async {
// Use dart CommandWrapper instance.
CommandResult result = await dart.run(['--version']);
print(result.stderr.join(''));// Create a new CommandWrapper.
CommandWrapper curl = new CommandWrapper('curl');
result = await curl.run(['--version']);
print(result.stdout.join(''));
}
```