Taskw

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

CommandDescription
initInitialize a new Taskw project with full scaffold
generateGenerate code from annotated Go files
scanPreview what will be generated
cleanRemove 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:

  1. Initialize a new project or configure an existing one
  2. Scan to preview what will be generated
  3. Generate the actual code
  4. 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 - Success
  • 1 - General error
  • 2 - Configuration error
  • 3 - 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