CLI Overview
Learn about Taskw CLI commands and common patterns
CLI Overview
Taskw provides a command-line interface for generating Go API code with Fiber, Wire, and Swagger integration. The CLI is built on top of Cobra and follows standard CLI conventions.
Command Structure
taskw [global-flags] <command> [subcommand] [flags] [arguments]
Available Commands
Command | Description |
---|---|
init | Initialize a new Taskw project with full scaffold |
generate | Generate code from annotated Go files |
scan | Preview what will be generated |
clean | Remove generated files |
Common Patterns
Configuration
Taskw uses a taskw.yaml
configuration file to define project settings. You can specify a custom config path using the --config
flag:
taskw --config /path/to/taskw.yaml generate
Code Generation Workflow
The typical workflow for using Taskw involves:
- Initialize a new project or configure an existing one
- Scan to preview what will be generated
- Generate the actual code
- Clean when you need to regenerate or switch configurations
# Initialize a new project
taskw init github.com/user/my-api
# Preview generation
taskw scan
# Generate code
taskw generate
# Clean generated files
taskw clean
Global Flags
All commands support these global flags:
--config string
- Path to taskw.yaml config file--help, -h
- Show help for command--version
- Show version information
Exit Codes
Taskw uses standard exit codes:
0
- Success1
- General error2
- Configuration error3
- Generation error
Getting Help
You can get help for any command using the --help
flag:
taskw --help
taskw init --help
taskw generate --help
Examples
Basic Project Setup
# Create a new project
taskw init github.com/myuser/ecommerce-api
# Navigate to project
cd ecommerce-api
# Generate initial code
taskw generate
Working with Existing Projects
# Scan existing codebase
taskw scan
# Generate only routes
taskw generate routes
# Generate only dependencies
taskw generate deps
# Clean and regenerate everything
taskw clean
taskw generate