cli

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cli holds the pure helpers of the command line: argument parsing and text formatting with no dependency on the server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialAddress

func DialAddress(listen string) string

DialAddress turns a listen address into one a local client can connect to: wildcard hosts become the loopback address.

func FormatDuration

func FormatDuration(duration time.Duration) string

FormatDuration renders an uptime in the two largest units: 3d4h, 2h13m, 5m10s, 45s.

func GeneratePassword

func GeneratePassword() (string, error)

GeneratePassword returns 24 random URL-safe characters.

func ParseKeyFilter

func ParseKeyFilter(raw string) (string, *string, error)

ParseKeyFilter splits "key" or "key=value". A nil value matches key presence only.

func ParseSeverity

func ParseSeverity(raw string) (int, error)

ParseSeverity accepts a level name (debug, info, warn, error, fatal) or its number 0-4.

func ParseTimeBound

func ParseTimeBound(raw string, now time.Time) (time.Time, error)

ParseTimeBound accepts an RFC 3339 timestamp or an age such as 30m, 6h or 2d, which resolves to now minus that age.

func ReadPassword

func ReadPassword(reader io.Reader) (string, error)

ReadPassword reads one password from reader and strips the line ending. An empty result fails.

func TailLines

func TailLines(path string, count int) (string, error)

TailLines returns the last count lines of the file at path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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