enough_console 0.0.2

A library to create awesome command line apps for Dart developers.

Available under the commercial friendly MPL Mozilla Public License 2.0.

Usage #

A simple usage example:

import 'package:enough_console/enough_console.dart';

void main() async {
  var console = Console(reset: true);
  console.print(
      '1 hello - rows=${console.numberOfRows}, cols=${console.numberOfColumns}');
  console.print('2 oh my');
  await console.readInput('next (1)');
  console.returnToLineMark();
  console.success('this should stay');
  console.addLineMark();
  console.print(
      '12456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 90ABC DEFGH IJKLMNO PQRST UVWX YZ a bcd efg hijklmno pqrstuv wxyz 123 456 789 0_->>> _ABC_ _DEF_ _GHJ_ _KLM_ _OPQ_ _RST_ _UVW_ _XYZ_ _abc_ _def_ _ghj_ _klm_ _nop_ _qrs_ _tuv_ _wxy_ ____z_____',
      TextStyle(
          foreground: Color.green,
          background: Color.white,
          padding: Box.distributed(1),
          margin: Box.horizonal(3),
          wrap: Wrap.word));
  await console.readInput('next (2)');
  console.returnToLineMark();
  console.previousLine();
  console.print(
      'top left',
      TextStyle(
          foreground: Color.white,
          background: Color.darkblue,
          horizontalAlignment: HorizontalAlignment.left,
          verticalAlignment: VerticalAlignment.top));
  console.print(
      'top right',
      TextStyle(
          foreground: Color.darkblue,
          background: Color.white,
          horizontalAlignment: HorizontalAlignment.right,
          verticalAlignment: VerticalAlignment.top));
  console.print(
      'bottom left',
      TextStyle(
          foreground: Color.white,
          background: Color.red,
          horizontalAlignment: HorizontalAlignment.left,
          verticalAlignment: VerticalAlignment.bottom));
  console.print(
      'CENTER',
      TextStyle(
          foreground: Color.white,
          background: Color.red,
          horizontalAlignment: HorizontalAlignment.center,
          verticalAlignment: VerticalAlignment.center));
  console.print(
      'bottom right',
      TextStyle(
          foreground: Color.green,
          background: Color.white,
          horizontalAlignment: HorizontalAlignment.right,
          verticalAlignment: VerticalAlignment.bottom));
}

Installation #

Add this dependency your pubspec.yaml file:

dependencies:
  enough_console: ^0.0.1

For more info visit pub.dev.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0.0.2 #

  • Add getCursorPosition support and fix bugs.

0.0.1 #

  • Initial version

example/enough_console_example.dart

import 'package:enough_console/enough_console.dart';

void main() async {
  var console = Console(reset: true);
  console.print(
      '1 hello - rows=${console.numberOfRows}, cols=${console.numberOfColumns}');
  console.print('2 oh my');
  await console.readInput('next (1)');
  console.returnToLineMark();
  console.success('this should stay');
  console.addLineMark();
  console.print(
      '12456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 90ABC DEFGH IJKLMNO PQRST UVWX YZ a bcd efg hijklmno pqrstuv wxyz 123 456 789 0_->>> _ABC_ _DEF_ _GHJ_ _KLM_ _OPQ_ _RST_ _UVW_ _XYZ_ _abc_ _def_ _ghj_ _klm_ _nop_ _qrs_ _tuv_ _wxy_ ____z_____',
      TextStyle(
          foreground: Color.green,
          background: Color.white,
          padding: Box.distributed(1),
          margin: Box.horizonal(3),
          wrap: Wrap.word));
  await console.readInput('next (2)');
  console.returnToLineMark();
  console.previousLine();
  console.print(
      'top left',
      TextStyle(
          foreground: Color.white,
          background: Color.darkblue,
          horizontalAlignment: HorizontalAlignment.left,
          verticalAlignment: VerticalAlignment.top));
  console.print(
      'top right',
      TextStyle(
          foreground: Color.darkblue,
          background: Color.white,
          horizontalAlignment: HorizontalAlignment.right,
          verticalAlignment: VerticalAlignment.top));
  console.print(
      'bottom left',
      TextStyle(
          foreground: Color.white,
          background: Color.red,
          horizontalAlignment: HorizontalAlignment.left,
          verticalAlignment: VerticalAlignment.bottom));
  console.print(
      'CENTER',
      TextStyle(
          foreground: Color.white,
          background: Color.red,
          horizontalAlignment: HorizontalAlignment.center,
          verticalAlignment: VerticalAlignment.center));
  console.print(
      'bottom right',
      TextStyle(
          foreground: Color.green,
          background: Color.white,
          horizontalAlignment: HorizontalAlignment.right,
          verticalAlignment: VerticalAlignment.bottom));

  //await console.readInput('done');
}

Use this package as a library

1. Depend on it

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


dependencies:
  enough_console: ^0.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:enough_console/enough_console.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
82
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Feb 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health issues and suggestions

Document public APIs. (-0.71 points)

100 out of 101 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/src/stack.dart.

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

Maintenance suggestions

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

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

The package description is too short. (-8 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
console ^3.1.0 3.1.0
Transitive dependencies
vector_math 2.0.8
Dev dependencies
pedantic ^1.8.0
test ^1.6.0