flags

package
v5.31.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package flags provides CLI flag handling utilities including benchmark timing.

Index

Constants

View Source
const BenchmarkFlagName = "benchmark"

BenchmarkFlagName is the global/root persistent flag that enables benchmark output.

Variables

This section is empty.

Functions

func IsBenchmarkEnabled added in v5.30.0

func IsBenchmarkEnabled(cmd *cobra.Command) (bool, error)

IsBenchmarkEnabled reports whether the current command invocation has benchmark enabled.

The flag is defined as a root persistent flag and inherited by subcommands.

func MaybeTimer

func MaybeTimer(cmd *cobra.Command, tmr timer.Timer) timer.Timer

MaybeTimer returns the provided timer when benchmark output is enabled.

When benchmark is disabled (or the flag is unavailable), it returns nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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