Cardinal CLI
The official command-line tool for the Cardinal Framework.
A powerful and zero-setup CLI for bootstrapping, managing, and generating files for your Cardinal-based command-line tools.
Key Features
- Quick Start: Scaffold a complete, runnable Cardinal project in seconds using
cardinal new. - Code Generation: Add new commands and templates to an existing project with
cardinal add. - Initialization: Configure Cardinal inside any existing Dart project using
cardinal init. - Zero Boilerplate: Focus on command logic, not setup.
Installation
To start building your own CLI with the Cardinal Framework, activate the official CLI globally via the Dart package manager:
dart pub global activate cardinal_cli
(Note: Requires a Dart SDK version compatible with the framework requirements.)
Quick Usage and Commands
The Cardinal CLI offers three core commands to manage your project lifecycle.
1. Create a New Project (new)
This is the fastest way to start. The new command scaffolds the complete directory structure, sets up the pubspec.yaml, and generates a runnable example command.
# Usage: cardinal new <project_name>
cardinal new my_awesome_cli
# Navigate to your new project and run it
cd my_awesome_cli
dart run
2. Initialize an Existing Project (init)
If you have an existing Dart project and wish to incorporate Cardinal, use init to create the necessary core file structure and configurations.
# Run inside the root folder of your existing Dart project
cardinal init
3. Add New Commands (add)
Use add to automatically generate the boilerplate for a new command class. The CLI creates the file in lib/commands/ and registers it in the main command runner.
# Usage: cardinal add <command_name>
cardinal add login
4. Full Command List
Your CLI supports the following primary commands:
| Command | Description |
|---|---|
new |
Creates a complete, ready-to-run new project structure. |
init |
Initializes and configures the core Cardinal structure in an existing project. |
add |
Generates a new command inside the current project. project. |
Framework Dependency
This CLI tool is the companion to the core library. To learn about defining arguments, options, and the execution context, please refer to the main package documentation:
Cardinal Framework on pub.flutter-io.cn
Contributing and Support
Please refer to the main Cardinal Framework repository for details on how to report issues, contribute code, or view the overall architecture.