@cambusa/cli v0.9.8
Cambusa CLI
š£ Cambusa CLI is a command-line interface for the Cambusa Framework, designed to streamline development tasks and manage your Cambusa application.
Installation
Install Cambusa CLI globally using npm:
npm install -g @cambusa/cliUsage
After installing globally, you can use the Cambusa CLI from any directory.
cambusa [command] [options]Global Options
-v, --version: Output the version number-l, --log-level <level>: Set log level (error, warn, info, verbose, debug, silly). Default is 'warn'.-h, --help: Display help for command
Commands
Initialize a New Project
Create a new Cambusa project:
cambusa init [projectName]Generate a Model
Generate a new model:
cambusa models:generate UserStart the Server
Start the Cambusa server:
cambusa liftInteractive REPL-like Session
Start an interactive REPL-like session:
cambusa replIn the REPL session, you can interact with the Cambusa instance directly. The Cambusa instance is available as cambusa.
Custom REPL Commands
routes: List all registered routesmodels: List all available modelshelp: Show available commandsexit: Exit the REPL-like session
REPL Examples
View the current configuration:
cambusa> cambusa.configUse the logger:
cambusa> cambusa.log.debug('test message')Fetch a user from the database (assuming you have a User model):
cambusa> await cambusa.models.User.findOne({ where: { id: 1 } })
Run Custom Scripts
Run custom scripts located within the ./scripts directory or its subdirectories:
cambusa run <scriptPath> [args...]Example: Running a Script in a Subdirectory
cambusa run migrations/migrateUsers --batchSize 200 --dryRun trueList Available Scripts
List all scripts available within the ./scripts directory and its subdirectories:
cambusa scripts:listNotes
- When using the CLI commands, ensure you are in the root directory of your Cambusa project.
- The REPL-like session provides a powerful way to interact with your Cambusa application but should be used cautiously, especially when performing operations that could modify your application state.
- Custom scripts should export a default asynchronous function that accepts the Cambusa instance and an array of arguments.
For more detailed information on each command and its options, use the --help flag:
cambusa [command] --help