cli_repl 0.2.3 copy "cli_repl: ^0.2.3" to clipboard
cli_repl: ^0.2.3 copied to clipboard

A simple library for creating CLI REPLs

example/example.dart

/// Example REPL that looks for a semicolon to complete a statement and then
/// echoes all completed statements.

import 'package:cli_repl/cli_repl.dart';

main(args) async {
  var v = (str) => str.trim().isEmpty || str.trim().endsWith(';');
  var repl = new Repl(prompt: '>>> ', continuation: '... ', validator: v);
  await for (var x in repl.runAsync()) {
    if (x.trim().isEmpty) continue;
    if (x == 'throw;') throw "oh no!";
    print(x);
  }
}
4
likes
110
pub points
95%
popularity

Publisher

unverified uploader

A simple library for creating CLI REPLs

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

async, js

More

Packages that depend on cli_repl