flags

package
v5.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package flags provides flag handling utilities for CLI commands.

This package contains helpers for working with Cobra command flags, including timing flag detection and conditional timer usage.

Index

Constants

View Source
const TimingFlagName = "timing"

TimingFlagName is the global/root persistent flag that enables timing output.

Variables

This section is empty.

Functions

func IsTimingEnabled

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

IsTimingEnabled reports whether the current command invocation has timing 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 timing output is enabled.

When timing 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