Installation
Requirements
Section titled “Requirements”- Go 1.27 or later
- An active Go module (
go.mod)
Install
Section titled “Install”Run this in your project directory:
go get github.com/larsartmann/cmdguard/v5@latestImport
Section titled “Import”import "github.com/larsartmann/cmdguard/v5/pkg/cmdguard/v5"For convenience, you can alias the import:
import v5 "github.com/larsartmann/cmdguard/v5/pkg/cmdguard/v5"Optional Sub-Modules
Section titled “Optional Sub-Modules”cmdguard’s core stays lean. Seven optional features live in standalone sub-modules so you import only what you need:
| Sub-module | Import path | Provides |
|---|---|---|
| glamour | github.com/larsartmann/cmdguard/glamour |
Markdown help rendering |
| prompts | github.com/larsartmann/cmdguard/prompts |
Interactive prompts via huh |
| spinner | github.com/larsartmann/cmdguard/spinner |
Terminal spinner middleware |
| telemetry | github.com/larsartmann/cmdguard/telemetry |
OpenTelemetry spans |
| flightrecorder | github.com/larsartmann/cmdguard/flightrecorder |
Runtime trace flight recorder |
| lint | github.com/larsartmann/cmdguard/lint |
cmdguard usage linter (CG001-CG008) |
| schema | github.com/larsartmann/cmdguard/schema |
JSON Schema emitter for config structs |
go get github.com/larsartmann/cmdguard/glamourVerify Installation
Section titled “Verify Installation”go list -m github.com/larsartmann/cmdguard/v5Next Steps
Section titled “Next Steps”- Follow the Quick Start for a complete example
- Learn about Type-Safe Flags to define flags with struct tags
- See Migrating from Cobra if you have an existing Cobra app
- Migrating from cmdguard v4? See the v4→v5 Migration Guide