Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package cli wires httpfly's command-line arguments to its subcommands.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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.

func Run

func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) error

Run dispatches args to a subcommand, reading from stdin and writing normal/error output to stdout/stderr respectively.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL