colorful_cmd 1.6.7

  • Readme
  • Changelog
  • Installing
  • 77

A library for building a beautiful command line application in dart.

GitHub repo size GitHub Last Tag GitHub last commit

Support Pub Version

GitHub stars GitHub forks

Dependency #

  • console
  • args

Preview #

Diff OS #

  • Ubuntu Ubuntu
  • Windows Windows
  • Mac Mac

ColorText #

ColorText

Command #

Command

RainbowProgress #

RainbowProgress

WindowUI #

WindowUI WindowUI2

Usage #

A simple usage example:

import 'package:dart_command/command.dart';
import 'package:dart_command/logger.dart';

void main(List<String> args) {
  var kernel = ConsoleKernel();
  kernel.addCommands([RootCommand()])
        .run(args);
}

class RootCommand extends ICmd {

  @override
  String name = 'root';

  @override
  String description = 'root command, without group';

  @override
  List<Flag> get flags => null;

  @override
  List<ILogHandler> get logHandlers => null;

  @override
  List<Option> get options => null;
  
  @override
  void run() {
    warning(description);
    var colorText = ColorText();
    colorText
      .gold('\n\n\ngold\n')
      .green('green\n')
      .blue('blue\n')
      .cyan('cyan\n')
      .darkBlue('darkBlue\n')
      .darkRed('darkRed\n')
      .gray('gray\n')
      .lightCyan('lightCyan\n')
      .lightGray('lightGray\n')
      .lightMagenta('lightMagenta\n')
      .lime('lime\n')
      .magenta('magenta\n')
      .red('red\n')
      .white('white\n')
      .black('black\n')
      .yellow('yellow\n')
      .print();
  }
}

For more examples, see the example folder.

0.0.1 #

  • Add basic function

0.0.2 #

  • Rename library

1.0.0 #

  • Add RainbowProgress
  • Add WindowUi
  • Update ColorText

1.1.0 #

  • Optimize menu render

1.2.0 #

  • WindowUI add bindKey() and bindKeys()

1.2.1 #

  • Fix the error when enter second page menu

1.3.0 #

  • Command add default command and update usage style.

1.3.1 #

  • Console kernel add exit flag

1.3.2 #

  • Fix: show cursor when command exit

1.4.0 #

  • WindowUI add beforeNextPage method

1.4.1 #

  • WindowUI expose menuStack property

1.4.2 #

  • WindowUI expose earseMenu method

1.4.3 #

  • WindowUI update earseMenu time

1.4.4 #

  • WindowUI expose displayMenuTitle method and menuTitle property

1.4.5 #

  • update WindowUI enterMenu method、add pageData property

1.4.6 #

  • update WindowUI displayItem

1.4.7 #

  • add Loader component

1.4.8 #

  • WindowUI use loader

1.5.0 #

  • optimize WindowUI

1.5.1 #

  • optimize WindowUI

1.5.2 #

  • optimize WindowUI

1.5.3 #

  • WindowUI expose prePage, nextPage, displayList

1.5.4 #

  • WindowUI add enter hook

1.5.5 #

  • add command notifier

1.5.6 #

  • fix invalid chars

1.5.7 #

  • add bottom out hook

1.5.8 #

  • update bottom out hook

1.5.9 #

  • update bottom out hook

1.6.0 #

  • update rainbow progress

1.6.1 #

  • add. Colors

1.6.2 #

  • WindowUI add menu back hook

1.6.3 #

  • fix title color

1.6.4 #

  • update WindowUI quit method

1.6.5 #

  • WindowUI expose maxMenuRow

1.6.6 #

  • WindowUI hide help option

1.6.7 #

  • WindowUI fix hide help

Use this package as a library

1. Depend on it

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


dependencies:
  colorful_cmd: ^1.6.7

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:colorful_cmd/command.dart';
import 'package:colorful_cmd/component.dart';
import 'package:colorful_cmd/exception.dart';
import 'package:colorful_cmd/lang.dart';
import 'package:colorful_cmd/logger.dart';
import 'package:colorful_cmd/utils.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
57
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
77
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15

Analysis suggestions

Package not compatible with runtime flutter-web on Web

Because:

  • package:colorful_cmd/command.dart that imports:
  • package:console/console.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:colorful_cmd/command.dart that imports:
  • package:console/console.dart that imports:
  • dart:io

Health suggestions

Fix lib/src/interface/i_cmd.dart. (-3.45 points)

Analysis of lib/src/interface/i_cmd.dart reported 7 hints, including:

line 27 col 9: DO use curly braces for all flow control structures.

line 44 col 11: DO use curly braces for all flow control structures.

line 48 col 13: DO use curly braces for all flow control structures.

line 68 col 11: DO use curly braces for all flow control structures.

line 72 col 13: DO use curly braces for all flow control structures.

Fix lib/src/interface/i_group.dart. (-0.50 points)

Analysis of lib/src/interface/i_group.dart reported 1 hint:

line 21 col 9: DO use curly braces for all flow control structures.

Format lib/src/component/apple_script_notifier.dart.

Run dartfmt to format lib/src/component/apple_script_notifier.dart.

Fix additional 11 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/component/base_window.dart (Run dartfmt to format lib/src/component/base_window.dart.)
  • lib/src/component/loader.dart (Run dartfmt to format lib/src/component/loader.dart.)
  • lib/src/component/notifier_proxy.dart (Run dartfmt to format lib/src/component/notifier_proxy.dart.)
  • lib/src/component/notifu_notifier.dart (Run dartfmt to format lib/src/component/notifu_notifier.dart.)
  • lib/src/component/notify_send_notifier.dart (Run dartfmt to format lib/src/component/notify_send_notifier.dart.)
  • lib/src/component/terminal_notifier.dart (Run dartfmt to format lib/src/component/terminal_notifier.dart.)
  • lib/src/component/window_ui.dart (Run dartfmt to format lib/src/component/window_ui.dart.)
  • lib/src/interface/i_notifier.dart (Run dartfmt to format lib/src/interface/i_notifier.dart.)
  • lib/src/kernel/console_kernel.dart (Run dartfmt to format lib/src/kernel/console_kernel.dart.)
  • lib/src/utils/color_text.dart (Run dartfmt to format lib/src/utils/color_text.dart.)
  • lib/src/utils/colors.dart (Run dartfmt to format lib/src/utils/colors.dart.)

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and colorful_cmd.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

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