coffee_cli 0.3.1

  • Example
  • Installing
  • Versions
  • 0

coffee_cli #

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

Usage #

Import #

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))

Example #

Fork of cupid

Changelog #

0.3.1 #

  • Better usage
  • Fix some bug on questions

0.3.0 #

  • 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


0.2.1 #

  • Fix various bugs

0.2.0 #

###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

0.1.1 #

Fix usage

0.1.0 #

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

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

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


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