capp 2.1.0
capp: ^2.1.0 copied to clipboard
This tool is perfect for creating console apps, offering widgets for Console elements, input handling, Help generation, argument events, and option configuration
2.1.0 #
writeHelpModernnow groups namespaced sub-commands: a controller namednamespace:subcommand(e.g.test:subtest, called exactly astest:subtest -i=5) is displayed nested under itsnamespaceheader instead of being listed as an unrelated top-level command. The command name and its description are now printed on the same line (name in bold green, description in yellow) instead of on two separate lines.- Added
example/example_app.dartentries (test:subtest,test:report) demonstrating namespaced sub-commands. - Added
CappConsole.writeAlertto print a message as a boxed, colored alert (info/success/warning/error) with a severity icon, wrapping long messages to fit the terminal width. - Added
example/example.dart"Alert" option and tests demonstratingwriteAlert.
2.0.0 #
- #3 Added command chaining: pass
--andbetween commands (e.g.test -p hello --and help --and exit) to run several commands, one after another, in a single invocation. Works for the initial CLI arguments as well as for lines typed at the interactive prompt (both line mode and raw mode). Before each next command runs, aNext command: ...message is printed.--andis only used as a separator, it's never forwarded to controllers/options and never appears in the generated help. - Added
example/example_chain.dartdemonstrating the new command chaining feature. - Added a GitHub Actions workflow to run the test suite on every push/PR.
- Greatly expanded the test suite: unit tests for
CappManager,CappConsole, andCappOption, plus integration tests that spawn the example apps to verify one-shot argument processing, interactive stdin sessions, and command chaining end-to-end.
1.1.8 #
- Added command history tracking to
CappManager, allowing navigation through previously entered commands using arrow keys - Added
onKeyPresscallback toCappManagerfor handling raw mode key events, enabling custom key bindings - Added dynamic
appLabelparameter toprocessWhile(replaces deprecatedpromptLabel), allowing prompt labels that update on each iteration (e.g., showing current time) - Added
removeCommandBarandaddToCommandBarstatic methods toCappConsolefor manipulating the command bar text in raw mode - Added
eventListenmethod toCappConsolefor stdin event listening - Updated
example_app.dartto demonstrate command history navigation and dynamic prompt labels
1.1.7 #
- Added
resetValuemethod toCappOptionto reset the option's value to its default value and setexistsInArgsto false. This allows for easier reuse of options across multiple command executions without retaining previous values, ensuring that each command starts with a clean slate for its options. TheresetValuemethod is called in theCappManagerbefore processing each command to ensure that options are reset before being populated with new values from the command arguments.
1.1.6 #
- Added
onSelectcallback toCappOptionto allow executing a function when an option is selected, even if it doesn't have a command associated with it. This is useful for options that are meant to trigger an action without requiring additional input, such as displaying help or toggling a setting.
1.1.4 #
- Added
_readKeymethod to handle key inputs - Supported arguments with
=in the_findOptionValuemethod, allowing options to be passed as--option=valueor-o=value - Added
writeHelpModernmethod to display help in a more modern and colorful way using ANSI escape codes - Supported breaking the loop in
processWhileby pressing the 'q' key, allowing users to exit the command processing loop gracefully while still receiving new commands
1.1.2 #
- Added
processWhileto keep the app running while receiving new commands, checkexample_app.dart
1.1.1 #
- Fixes #1 warning color
1.1.0 #
- Added Json View
- Added Menu View
- Added Multi Choice View
1.0.3 #
- Fixed bug
1.0.2 #
- Added Progress timer
1.0.1 #
- Fixed bug
- Added documentation
- Added example
1.0.0 #
- Deploy Capp package to pub