escli 0.0.1

  • Installing
  • Versions
  • 0


Build Status License Dart

The complete solution for Dart command-line interfaces, inspired by node commander.js which created by tj.


cause I don't like build the cli app with other exist lib.

those api are not graceful enough. so I want build a lib use like commander.js

it make you move cli tool from Nodejs easier.

This lib in developing. I can't make sure it work like expect even I have write many test cases.

Enjoy it!


  • dart>=1.20.0


  • [x] Windows
  • [x] Linux
  • [x] MacOS


Option parsing

#!/usr/bin/env dart

import 'package:escli/escli.dart' show Commander;

void main(List<String> arguments){
  Commander program = new Commander();
    ..description('test desc')
    ..usage('<command> [options]')
    ..option('-p, --peppers', 'Add peppers')
    ..option('-P, --pineapple', 'Add pineapple')
    ..option('-b, --bbq-sauce', 'Add bbq sauce')
    ..option('-c, --cheese [type]', 'Add the specified type of cheese [marble]');
  print('--peppers: ${program.$option["peppers"]}');
  print('--pineapple: ${program.$option["pineapple"]}');
  print('--bbq-sauce: ${program.$option["bbqSauce"]}');
  print('--cheese: ${program.$option["cheese"]}');
  print('enjoy it');


import 'package:escli/escli.dart' show Commander;
void main(List<String> arguments) {
  Commander program = new Commander();

  parseInt(int n){
    print('--interger: $n');
  parseFlow(num n){
    print('--float: $n');
  range(val) {
    print('--float: $val');

  list(val) {
    print('--list: $val');

  collect(val) {
    print('--optional: $val');

  increaseVerbosity(val) {
    print('--verbose: $val');

    ..description('test desc')
    ..usage('<command> [options]')
    ..option('-i, --integer <n>', 'An integer argument', parseInt)
    ..option('-f, --float <n>', 'A float argument', parseFlow)
    ..option('-r, --range <a>..<b>', 'A range', range)
    ..option('-l, --list <items>', 'A list', list)
    ..option('-o, --optional [value]', 'An optional value')
    ..option('-c, --collect [value]', 'A repeatable value', collect)
    ..option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)

Specify the argument syntax

import 'package:escli/escli.dart' show Commander;

void main(List<String> arguments){
  Commander program = new Commander();

    ..arguments('<cmd> [env]')
    ..action((Map argv, Map options) {


Git-style sub-commands (Recommend)

import 'package:escli/escli.dart' show Commander;

void main(List<String> arguments) {
  Commander program = new Commander();


    .command('install [name]', 'install one or more packages')
    .action((Map argv, Map options) {


    .command('search [query]', 'search with optional query')
    .action((Map argv, Map options) {

    .command('list', 'list packages installed')
    .action((Map argv, Map options) {


Automated -h, --help

$ gpmx -h

  Usage: gpmx <command> [options]

    Git Package Manager, make you manage the repository easier, Power by Dart

    ls|list              display the all repo.
    ad|add <repo>        clone repo into local dir.
    rm|remove            remove a repo.
    cl|clean             clean the temp/cache.
    rt|runtime           print the program runtime, useful for submit a issue.
    rl|relink            relink the base dir which contain repositories if you delete repository manually.
    ip|import <dir>      register a repository to GPM.

    -V, --version      print the current version
    -h, --help         print the help info about 

Automated -V, --version

$ gpmx --version

Complete Demo




git clone
cd ./commander.dart
pub get

You can flow Contribute Guide


The MIT License



  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

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

  escli: ^0.0.1

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:escli/escli.dart';
Version Uploaded Documentation Archive
0.0.1 Mar 6, 2017 Go to the documentation of escli 0.0.1 Download escli 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
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

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.1.0.
 Because escli depends on ee any which requires SDK version <2.0.0, version solving failed.

Health suggestions

Format lib/command.dart.

Run dartfmt to format lib/command.dart.

Format lib/escli.dart.

Run dartfmt to format lib/escli.dart.

Format lib/option.dart.

Run dartfmt to format lib/option.dart.

Format lib/utils.dart.

Run dartfmt to format lib/utils.dart.

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Fix analysis_options.yaml.

We were unable to parse analysis_options.yaml.

Package is getting outdated. (-76.44 points)

The package was released 92 weeks ago.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use escli.dart.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.