command_wrapper 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 4

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 package.

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<String> so you can easily process each line.

Command

command_wrapper provides wrappers for commonly used Dart commands.

  • dart
  • pub
  • dart2js
  • dartfmt
  • dartanalyzer
  • dartdoc

Examples

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(''));
}

Changelog

0.2.0

  • Add stdin argument to run method

0.1.0

  • Initial version

Use this package as a library

1. Depend on it

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


dependencies:
  command_wrapper: ^0.2.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:command_wrapper/command_wrapper.dart';
  
Version Uploaded Documentation Archive
0.2.0 Oct 21, 2016 Go to the documentation of command_wrapper 0.2.0 Download command_wrapper 0.2.0 archive
0.1.0 Oct 20, 2016 Go to the documentation of command_wrapper 0.1.0 Download command_wrapper 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
8
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
4
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.

Dependencies

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