cli_util 0.4.2 copy "cli_util: ^0.4.2" to clipboard
cli_util: ^0.4.2 copied to clipboard

A library to help in building Dart command-line apps.

example/main.dart

// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'package:cli_util/cli_logging.dart';

Future<void> main(List<String> args) async {
  final verbose = args.contains('-v');
  final logger = verbose ? Logger.verbose() : Logger.standard();

  logger.stdout('Hello world!');
  logger.trace('message 1');
  await Future<void>.delayed(const Duration(milliseconds: 200));
  logger.trace('message 2');
  logger.trace('message 3');

  final progress = logger.progress('doing some work');
  await Future<void>.delayed(const Duration(seconds: 2));
  progress.finish(showTiming: true);

  logger.stdout('All ${logger.ansi.emphasized('done')}.');
}
74
likes
150
points
3.65M
downloads

Publisher

verified publishertools.dart.dev

Weekly Downloads

A library to help in building Dart command-line apps.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

meta, path

More

Packages that depend on cli_util