cli_tools
0.14.0, released 5 days ago by serverpod.dev
Utilities for building command‑line interfaces, including argument parsing, analytics, and progress reporting.
What it does
Provides a set of helper libraries for CLI applications such as a configurable command runner, analytics base class, and progress display. It also includes experimental command‑line completion support. The package is framework‑agnostic and can be used in any Dart project.
AI-written summary of version 0.14.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a ready‑made command runner with built‑in analytics and progress UI for a Dart CLI tool
- You want easy integration of command‑line completion and configurable logging
Skip it when
- You are building a GUI or web app
- You require a full‑featured CLI framework with sub‑command scaffolding beyond what this package offers
Strengths
- Simple, opinionated API for common CLI needs
- Built‑in analytics flushing and progress streams
- Experimental completion support
Weaknesses
- Limited to command‑line use; no UI components
- Breaking changes in recent versions may require migration
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 9
import 'package:cli_tools/cli_tools.dart';
void main() async {
final runner = BetterCommandRunner('my_cli', 'Example CLI');
runner.addCommand(EchoCommand());
await runner.run(arguments);
}
class EchoCommand extends Command {
@override final name = 'echo';
@override final description = 'Prints the given text.';
EchoCommand() { argParser.addOption('text', abbr: 't'); }
@override void run() => print(argResults!['text']);
}Alternatives
Packages that do the same job and could replace cli_tools.
- cli_util
Utilities to help build Dart command-line apps, find the SDK, and display progress.
88Compare - cli_completion
Completion functionality for Dart Command-Line Interfaces built using CommandRunner.
85Compare - dart_style
Provides an API and CLI to format Dart source code automatically.
89Compare - git
Git command line wrapper for inspecting and manipulating local Git repositories.
89Compare
Works with
Packages commonly used together with cli_tools: ones it builds on, ones built on it, and its own family.
- pub_semvercli_tools depends on itVersions and version constraints implementing pub's versioning policy.
- asynccli_tools depends on itUtility classes and helpers that extend Dart's async library.
- argscli_tools depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- cicli_tools depends on itDetect CI environments and inspect CI vendor details in Dart scripts.
- configcli_tools depends on itTyped CLI argument and config file parser with env support
- pub_api_clientcli_tools depends on itAn unofficial API client for Pub.dev to interact with public package information.
- super_stringcli_tools depends on itProvides common string manipulation and validation extension methods.
- serverpod_cliBuilt on cli_toolsCommand line tools for Serverpod.