dscript_exec 1.0.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new50

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

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages 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

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
50

Platforms

Detected platforms: Flutter, other

Primary library: package:dscript_exec/dscript_exec.dart with components: io.

Suggestions

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use dscript_exec.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
Dev dependencies
test ^0.12.0