bosun
0.2.2, released 4 years ago by an unverified publisher
Library for parsing CLI input and structuring commands
What it does
Bosun parses command line arguments and flags into a structured command tree, automatically generates help text, and suggests similar commands when an invalid command is entered.
AI-written summary of version 0.2.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building command line tools or scripts in Dart
- Creating nested command hierarchies for CLI applications
- Automating tests that involve command line parsing
Skip it when
- Developing purely graphical user interfaces
- Applications that do not require command line interaction
Strengths
- Simple, declarative command definitions
- Automatic help generation and error suggestions
- Supports subcommands and flag parsing
Weaknesses
- Limited to CLI use cases
- No built‑in support for async command execution
- Documentation is still growing
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:bosun/bosun.dart';
class AppCmd extends Command {
AppCmd() : super(command: 'app', description: 'run as an app shell');
@override
void run(List<String> args, Map<String, dynamic> flags) {
print("in the app command callback");
}
}
class RunCmd extends Command {
RunCmd() : super(
command: 'run',
description: 'Run a command in a shell',
subcommands: [AppCmd()]);
@override
void run(List<String> args, Map<String, dynamic> flags) {
print("in the run command callback");
}
}
void main(List<String> args) {
execute(BosunCommand('donker', subcommands: [RunCmd()]), args);
}Alternatives
Packages that do the same job and could replace bosun.
- config
Typed CLI argument and config file parser with env support
84Compare - args
Library for parsing raw command-line arguments into options and values using GNU and POSIX styles.
82Compare - deep_pick
Type-safe API for manual JSON parsing with useful error messages.
91Compare - dart_console
A helper library for command-line applications requiring advanced control over input/output.
86Compare