dscript_exec 1.0.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 0

Exec

Bash like command piping and redirecting for Dart to make writing Dart scripts easier.

Say good-bye to bash, python and batch file scripting! Invest in a sound language with amazing analyzer tools!

From the authors of Jaguar.dart.

Usage

Execute a command

await exec('rm', ['example/dest.csv']).run();

Access command output

final String out = await exec('cat', ['example/names.csv']).runGetOutput();
print(out);

or

await exec('cat', ['example/names.csv']).runGetOutput(onFinish: print);

Pipe

await exec('cat', ['example/names.csv'])
  .pipe(exec('cut', ['-d', "','", '-f', '1']))
  .runGetOutput(onFinish: print);

Output redirection

await (exec('cat', ['example/names.csv']) |
          exec('cut', ['-d', "','", '-f', '1']) >
      new Uri(path: 'example/dest.csv'))
  .run();

Input redirection

await (exec('cut', ['-d', "','", '-f', '1']) <
      '''
John,Smith,34,London
Arthur,Evans,21,Newport
George,Jones,32,Truro
      ''')
  .runGetOutput(onFinish: print);

Inline functions

await exec('cat', ['example/names.csv'])
  .pipeInlineLine(
      (Stream<String> stream) => stream.map((s) => s.split(',')[1]))
  .runGetOutput(onFinish: print);

TODO

  • [ ] Catch and report error in sub-commands
  • [ ] Support other encoders
  • [ ] Support stderr redirection
  • [ ] Test multiple redirections
  • [ ] Support &, | and ~ concepts

Changelog

1.0.0

  • Pipes
  • Output redirection
  • Input redirection
  • Inline commands

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dscript_exec: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dscript_exec/dscript_exec.dart';
  
Version Uploaded Documentation Archive
1.0.0 Jan 30, 2018 Go to the documentation of dscript_exec 1.0.0 Download dscript_exec 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0