Documentation
¶
Overview ¶
Package cli wires httpfly's command-line arguments to its subcommands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSilent = errors.New("")
ErrSilent marks a returned error whose message must not be printed -- used when the caller (currently just "run -json") has already written its complete, parseable output to stdout and a human-readable summary alongside it would risk corrupting that output for a tool reading it (e.g. one that merges stdout and stderr). The exit code still reflects failure; wrap it with fmt.Errorf's %w or return it directly.
var Version = "dev"
Version is httpfly's version. It defaults to "dev" for local builds (go run, go build without flags) and is overridden at release-build time via:
go build -ldflags "-X github.com/cristianradulescu/httpfly/internal/cli.Version=X.Y.Z"
(see the Makefile's build target). Callers that display a version should use EffectiveVersion instead, which also covers "go install".
Functions ¶
func EffectiveVersion ¶ added in v0.3.1
func EffectiveVersion() string
EffectiveVersion returns Version if it was set via the ldflags above, or else falls back to the module version Go's toolchain embeds automatically in the binary when it's built with "go install .../cmd/httpfly@vX.Y.Z" (or any other module-aware build that doesn't go through the Makefile). Without this fallback, "go install" -- which never runs the Makefile and so never sets Version -- would always report "dev" even for a tagged release. The module version's leading "v" (e.g. "v0.3.0") is stripped so it matches the unprefixed X.Y.Z the Makefile's build produces, from the VERSION file -- and the tags this project's releases use are themselves "vX.Y.Z", so this is the same string either way.
Types ¶
This section is empty.