-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Overview
Add a --version flag to display cisshgo version information.
Requirements
Output Format
$ ./cisshgo --version
cisshgo version 1.0.0Or with build info:
$ ./cisshgo --version
cisshgo version 1.0.0
commit: abc123def
built: 2026-03-01T12:00:00Z
go: go1.26Implementation
1. Add to CLI Struct
type CLI struct {
Version kong.VersionFlag `short:"v" help:"Show version information"`
Listeners int `help:"How many listeners to spawn." default:"50" short:"l" env:"CISSHGO_LISTENERS"`
// ... rest of fields
}2. Update Kong Parser
var (
version = "dev"
commit = "none"
date = "unknown"
)
func main() {
kong.Parse(&cli,
kong.Name("cisshgo"),
kong.Description("Lightweight SSH server that emulates network equipment for testing."),
kong.Vars{
"version": fmt.Sprintf("%s (commit: %s, built: %s)", version, commit, date),
},
)
// ...
}3. Update GoReleaser
Ensure build-time variables are set in .goreleaser.yml:
builds:
- ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}Deliverables
- Add Version field to CLI struct
- Add version variables (version, commit, date)
- Update Kong parser with version vars
- Update .goreleaser.yml with ldflags
- Test locally:
go run -ldflags "-X main.version=dev" cissh.go --version - Update documentation with --version flag
- Add to CLI reference docs
Testing
# Development build
go run -ldflags "-X main.version=dev" cissh.go --version
# Release build (via goreleaser)
./cisshgo --versionRelated
- Part of v1.0.0 release preparation
- Nice-to-have, not blocking
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request