coffee_cli 0.3.1

  • Example
  • Installing
  • Versions
  • 29


Easy way to create interactive command line application.

  • Parameter your cli with automatic usage
  • Ask question to user, with defautValue and allowed value parametrable
  • termcaps interaction for choice of allowed parameter



import 'package:coffee_cli/coffee_cli.dart';

2 differents usage

Extends CoffeeCli class

class MyCli extends CoffeeCli {
  @CoffeeCommand(help: "Command usage")
  void command(String value, @CoffeeParameter(defaultValue: 42.42) double otherValue) {
  @CoffeeCommand(help: "Command usage")
  void otherCommand(@CoffeeParameter(allowed: const ["foo", "bar", "42"]) String value) {

  usage() {
    print(outputGray("My awesome cli.", level: 0.5));
main(List<String> args) {
  return new MyCli().execute(args);

Use addCommand function

Define a function to call

myFunction(String value, @CoffeeParameter(defaultValue: 42.42) double otherValue) {

Define the cli

main(List<String> args) {
 return new CoffeeCli()
    ..addCommand("command", const CoffeeCommand(function: myFunction))


Fork of cupid



  • Better usage
  • Fix some bug on questions


  • When allowed is provide in a parameter, the cli provide an interactive chooser of available parameter

###Breaking Change

  • Construction of the cli has no change, you can now:
    • create a class extending CoffeeCli and annotate you function
    • instanciate CoffeeCli and use addCommand



  • Fix various bugs


###Breaking Change

  • CoffeeParameter
    • possibleValues in CoffeeParameter change by allowed
    • bool parameter are no define as a flag
  • CoffeeCommand
    • command rename by executable
    • subcommands rename by commands
  • Can add CoffeeCommand as subcommand of an other CoffeeCommand
  • Better usage


Fix usage


Easy way to create interactive command line application


// Copyright (c) 2016, <your name>. All rights reserved. Use of this source code

// is governed by a BSD-style license that can be found in the LICENSE file.
import 'package:coffee_cli/coffee_cli.dart';

class PolymerElementGenerator extends CoffeeCli {
  static const _cliHelp = "Polyce element, create and manage Polymer Elements.";
  static const _nameHelp = "Name of your element";
  static const _outputHelp = "Where would you like to create this element";
  static const _autonotifyHelp = "Whould you like to use polymer_autonotify";

  static CoffeeQuestion _questionOutputElement(CoffeeQuestion original) {
    return new CoffeeQuestion(_outputHelp, defaultValue: "./");

  void create(@CoffeeParameter(help: _nameHelp, question: _nameHelp) String name,
      {@CoffeeParameter(help: _outputHelp, defineQuestion: _questionOutputElement) String output,
      @CoffeeParameter(help: _outputHelp, question: _autonotifyHelp) bool autonotify: true}) {

  usage() {
    print(outputGray(_cliHelp, level: 0.5));

class PolyceCli extends CoffeeCli {
  @CoffeeCommand(help: "Element command usage")
  CoffeeCli element = new PolymerElementGenerator();

  @CoffeeCommand(help: "Init command usage")
  void init() {}

  @CoffeeCommand(help: "Toto command usage")
  void toto(@CoffeeParameter(allowed: const ["truc", "titi", "tata"]) String test) {}

  usage() {
    print(outputGray("Polyce cli, create and manage Polymer Dart Application.", level: 0.5));

testFunction(String value, @CoffeeParameter(defaultValue: 42.42) double otherValue) {

main(List<String> args) {
  return new PolyceCli().execute(args);

Use this package as a library

1. Depend on it

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

  coffee_cli: "^0.3.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:coffee_cli/coffee_cli.dart';
Version Uploaded Documentation Archive
0.3.1 Jun 17, 2016 Go to the documentation of coffee_cli 0.3.1 Download coffee_cli 0.3.1 archive
0.3.0 Jun 13, 2016 Go to the documentation of coffee_cli 0.3.0 Download coffee_cli 0.3.0 archive
0.2.1 Jun 3, 2016 Go to the documentation of coffee_cli 0.2.1 Download coffee_cli 0.2.1 archive
0.2.0 Jun 2, 2016 Go to the documentation of coffee_cli 0.2.0 Download coffee_cli 0.2.0 archive
0.1.1 Jun 2, 2016 Go to the documentation of coffee_cli 0.1.1 Download coffee_cli 0.1.1 archive
0.1.0 Jun 2, 2016 Go to the documentation of coffee_cli 0.1.0 Download coffee_cli 0.1.0 archive


We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


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


Detected platforms: other

Primary library: package:coffee_cli/coffee_cli.dart with components: io, isolate, mirrors.


  • Package is too old.

    The package was released more than two years ago.

  • The description is too short.

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

  • Package is pre-v1 release.

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

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 8 hints.

    Run dartfmt to format lib/coffee_cli.dart.

    Run dartfmt to format lib/src/asker.dart.

    Similar analysis of the following files failed:

    • lib/src/coffee.dart (hint)
    • lib/src/command.dart (hint)
    • lib/src/execute.dart (hint)
    • lib/src/parameter.dart (hint)
    • lib/src/question.dart (hint)
  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
ansicolor ^0.0.9 0.0.9 0.1.0
args ^0.13.4+2 0.13.7 1.4.3
console ^2.2.3 2.2.4 3.0.0
resource ^1.1.0 1.1.0 2.1.4
stack_trace >=1.3.3 <2.0.0 1.9.2
worker ^0.5.0 0.5.0
Transitive dependencies
matcher 0.12.3
path 1.6.1
quiver 0.22.0 0.29.0+1
typed_data 1.1.5
vector_math 1.4.7 2.0.7
Dev dependencies
test >=0.12.0 <0.13.0
testcase >=0.1.0 <0.2.0