flags

package
v23.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package flags provides helper methods for working with Cobra flags in a way where Go's usage checker (which produces compilation errors for unused variables) enforces that the programmer didn't forget to define or read the flag.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(desc string) (AddFunc, ReadAllFlagFunc)

All provides type-safe access to the CLI arguments of type configdomain.SyncAllBranches.

func AutoResolve

func AutoResolve() (AddFunc, ReadAutoResolveFlagFunc)

type-safe access to the CLI arguments of type configdomain.AutoResolve

func Beam

func Beam() (AddFunc, ReadBeamFlagFunc)

type-safe access to the CLI arguments of type configdomain.Beam

func BranchType

func BranchType() (AddFunc, ReadTypeFlagFunc)

BranchType provides type-safe access to the CLI arguments of type configdomain.BranchType.

func Browser

func Browser() (AddFunc, ReadBrowserFlagFunc)

type-safe access to the CLI arguments of type browserdomain.Browser

func Commit

func Commit() (AddFunc, ReadCommitFlagFunc)

type-safe access to the CLI arguments of type configdomain.Commit

func CommitMessage

func CommitMessage(desc string) (AddFunc, ReadCommitMessageFlagFunc)

type-safe access to the CLI arguments of type gitdomain.CommitMessage

func CommitMessageFile

func CommitMessageFile() (AddFunc, ReadCommitMessageFileFlagFunc)

provides type-safe access to the CLI arguments of type gitdomain.MessageFile

func Detached

func Detached() (AddFunc, ReadDetachedFlagFunc)

type-safe access to the CLI arguments of type configdomain.Detached

func DiffFilter

func DiffFilter() (AddFunc, ReadDiffFilterFlagFunc)

type-safe access to the CLI arguments of type gitdomain.DiffFilter

func Displaytypes

func Displaytypes() (AddFunc, ReadDisplayTypesFlagFunc)

type-safe access to the CLI arguments of type configdomain.Displaytypes

func DryRun

func DryRun() (AddFunc, ReadDryRunFlagFunc)

type-safe access to the CLI arguments of type configdomain.DryRun

func Force

func Force(desc string) (AddFunc, ReadForceFlagFunc)

type-safe access to the CLI arguments of type configdomain.Force

func Gone

func Gone() (AddFunc, ReadGoneFlagFunc)

type-safe access to the CLI arguments of type configdomain.Gone

func IgnoreUncommitted

func IgnoreUncommitted() (AddFunc, ReadIgnoreUncommittedFlagFunc)

type-safe access to the CLI arguments of type configdomain.IgnoreUncommitted

func Interactive

func Interactive() (AddFunc, ReadInteractiveFlagFunc)

type-safe access to the CLI arguments of type configdomain.Interactive

func Merge

func Merge() (AddFunc, ReadMergeFlagFunc)

type-safe access to the CLI arguments of type configdomain.ShipIntoNonPerennialParent

func NameOnly

func NameOnly() (AddFunc, ReadNameOnlyFlagFunc)

NameOnly provides type-safe access to the CLI arguments of type configdomain.NameOnly.

func NoParent

func NoParent() (AddFunc, ReadNoneFlagFunc)

type-safe access to the CLI arguments of type configdomain.None

func NoVerify

func NoVerify() (AddFunc, ReadNoVerifyFlagFunc)

type-safe access to the CLI arguments of type configdomain.CommitHook

func Order

func Order() (AddFunc, ReadOrderFlagFunc)

type-safe access to the CLI arguments of type configdomain.Order

func Park

func Park() (AddFunc, ReadParkFlagFunc)

Park provides type-safe access to the CLI arguments of type Park.

func ParseBranchTypes

func ParseBranchTypes(text stringss.Trimmed, source string) ([]configdomain.BranchType, error)

func Pending

func Pending() (AddFunc, ReadPendingFlagFunc)

type-safe access to the CLI arguments of type configdomain.Pending

func ProposalBody

func ProposalBody(short string) (AddFunc, ReadProposalBodyFlagFunc)

type-safe access to the CLI arguments of type gitdomain.ProposalBody

func ProposalBodyFile

func ProposalBodyFile() (AddFunc, ReadProposalBodyFileFlagFunc)

provides type-safe access to the CLI arguments of type gitdomain.ProposalBodyFile

func ProposalTitle

func ProposalTitle() (AddFunc, ReadProposalTitleFlagFunc)

type-safe access to the CLI arguments of type gitdomain.ProposalTitle

func Propose

func Propose() (AddFunc, ReadProposeFlagFunc)

type-safe access to the CLI arguments of type configdomain.Propose

func Prototype

func Prototype() (AddFunc, ReadPrototypeFlagFunc)

type-safe access to the CLI arguments of type configdomain.Prototype

func Prune

func Prune() (AddFunc, ReadPruneFlagFunc)

type-safe access to the CLI arguments of type configdomain.Prune

func Push

func Push() (AddFunc, ReadPushFlagFunc)

type-safe access to the CLI arguments of type configdomain.PushBranches

func Redact

func Redact() (AddFunc, ReadRedactFlagFunc)

Redact provides type-safe access to the CLI arguments for redacting sensitive information.

func ShipIntoNonPerennialParent

func ShipIntoNonPerennialParent() (AddFunc, ReadShipIntoNonPerennialParentFlagFunc)

type-safe access to the CLI arguments of type configdomain.ShipIntoNonPerennialParentLong

func ShipStrategy

func ShipStrategy() (AddFunc, ReadShipStrategyFunc)

type-safe access to the CLI arguments of type configdomain.ShipStrategy

func SplitBranchTypeNames

func SplitBranchTypeNames(text stringss.Trimmed) []stringss.Trimmed

func Stack

func Stack(description string) (AddFunc, ReadStackFlagFunc)

Stack provides type-safe access to the CLI arguments of type configdomain.FullStack.

func Stash

func Stash() (AddFunc, ReadStashFlagFunc)

Stash provides type-safe access to the CLI arguments of type configdomain.Stash.

func Sync

func Sync() (AddFunc, ReadSyncFlagFunc)

Sync provides type-safe access to the CLI arguments of type configdomain.AutoSync.

func Up

func Up() (AddFunc, ReadUpFlagFunc)

Up provides type-safe access to the CLI arguments of type configdomain.Up. The flag can be used in two ways: - --up (uses default value of 1) - --up=2 (uses the specified integer value)

func Verbose

func Verbose() (AddFunc, ReadVerboseFlagFunc)

Verbose provides type-safe access to the CLI arguments of type configdomain.Verbose.

func Version

func Version() (AddFunc, ReadBoolFlagFunc)

Types

type AddFunc

type AddFunc func(*cobra.Command)

AddFunc defines the type signature for helper functions that add a CLI flag to a Cobra command.

type ReadAllFlagFunc

type ReadAllFlagFunc func(*cobra.Command) (configdomain.AllBranches, error)

ReadAllFlagFunc is the type signature for the function that reads the "all" flag from the args to the given Cobra command.

type ReadAutoResolveFlagFunc

type ReadAutoResolveFlagFunc func(*cobra.Command) (Option[configdomain.AutoResolve], error)

ReadAutoResolveFlagFunc is the type signature for the function that reads the "auto-resolve" flag from the args to the given Cobra command.

type ReadBeamFlagFunc

type ReadBeamFlagFunc func(*cobra.Command) (configdomain.Beam, error)

ReadBeamFlagFunc is the type signature for the function that reads the "beam" flag from the args to the given Cobra command.

type ReadBoolFlagFunc

type ReadBoolFlagFunc func(*cobra.Command) (bool, error)

type ReadBrowserFlagFunc

type ReadBrowserFlagFunc func(*cobra.Command) (Option[browserdomain.BrowserExecutable], Option[browserdomain.BrowserEnabled], error)

ReadCommitMessageFlagFunc defines the type signature for helper functions that provide the value a string CLI flag associated with a Cobra command.

type ReadCommitFlagFunc

type ReadCommitFlagFunc func(*cobra.Command) (configdomain.Commit, error)

ReadCommitFlagFunc is the type signature for the function that reads the "commit" flag from the args to the given Cobra command.

type ReadCommitMessageFileFlagFunc

type ReadCommitMessageFileFlagFunc func(*cobra.Command) (Option[gitdomain.CommitMessageFile], error)

ReadCommitMessageFileFlagFunc reads gitdomain.CommitMessageFile from the CLI args.

type ReadCommitMessageFlagFunc

type ReadCommitMessageFlagFunc func(*cobra.Command) (Option[gitdomain.CommitMessage], error)

ReadCommitMessageFlagFunc defines the type signature for helper functions that provide the value a string CLI flag associated with a Cobra command.

type ReadDetachedFlagFunc

type ReadDetachedFlagFunc func(*cobra.Command) (Option[configdomain.Detached], error)

ReadDetachedFlagFunc is the type signature for the function that reads the "detached" flag from the args to the given Cobra command.

type ReadDiffFilterFlagFunc

type ReadDiffFilterFlagFunc func(*cobra.Command) (Option[configdomain.DiffFilter], error)

ReadCommitMessageFlagFunc defines the type signature for helper functions that provide the value a string CLI flag associated with a Cobra command.

type ReadDisplayTypesFlagFunc

type ReadDisplayTypesFlagFunc func(*cobra.Command) (Option[configdomain.DisplayTypes], error)

ReadDisplayTypesFlagFunc is the type signature for the function that reads the "display-types" flag from the args to the given Cobra command.

type ReadDryRunFlagFunc

type ReadDryRunFlagFunc func(*cobra.Command) (Option[configdomain.DryRun], error)

ReadDryRunFlagFunc is the type signature for the function that reads the "dry-run" flag from the args to the given Cobra command.

type ReadForceFlagFunc

type ReadForceFlagFunc func(*cobra.Command) (configdomain.Force, error)

ReadForceFlagFunc is the type signature for the function that reads the "force" flag from the args to the given Cobra command.

type ReadGoneFlagFunc

type ReadGoneFlagFunc func(*cobra.Command) (configdomain.Gone, error)

type ReadIgnoreUncommittedFlagFunc

type ReadIgnoreUncommittedFlagFunc func(*cobra.Command) (Option[configdomain.IgnoreUncommitted], error)

ReadIgnoreUncommittedFlagFunc is the type signature for the function that reads the "ignore-uncommitted" flag from the args to the given Cobra command.

type ReadInteractiveFlagFunc

type ReadInteractiveFlagFunc func(*cobra.Command) (Option[configdomain.Interactive], error)

ReadInteractiveFlagFunc is the type signature for the function that reads the "interactive" flag from the args to the given Cobra command.

type ReadMergeFlagFunc

type ReadMergeFlagFunc func(*cobra.Command) (configdomain.SwitchUsingMerge, error)

type ReadNameOnlyFlagFunc

type ReadNameOnlyFlagFunc func(*cobra.Command) (Option[configdomain.NameOnly], error)

ReadNameOnlyFlagFunc is the type signature for the function that reads the "name-only" flag from the args to the given Cobra command.

type ReadNoVerifyFlagFunc

type ReadNoVerifyFlagFunc func(*cobra.Command) (configdomain.CommitHook, error)

ReadNoVerifyFlagFunc is the type signature for the function that reads the "no-verify" flag from the args to the given Cobra command.

type ReadNoneFlagFunc

type ReadNoneFlagFunc func(*cobra.Command) (configdomain.NoParent, error)

ReadNoneFlagFunc is the type signature for the function that reads the "none" flag from the args to the given Cobra command.

type ReadOrderFlagFunc

type ReadOrderFlagFunc func(*cobra.Command) (Option[configdomain.Order], error)

ReadOrderFlagFunc is the type signature for the function that reads the "order" flag from the args to the given Cobra command.

type ReadParkFlagFunc

type ReadParkFlagFunc func(*cobra.Command) (configdomain.Park, error)

type ReadPendingFlagFunc

type ReadPendingFlagFunc func(*cobra.Command) (configdomain.Pending, error)

ReadPendingFlagFunc is the type signature for the function that reads the "pending" flag from the args to the given Cobra command.

type ReadProposalBodyFileFlagFunc

type ReadProposalBodyFileFlagFunc func(*cobra.Command) (Option[gitdomain.ProposalBodyFile], error)

ReadProposalBodyFileFlagFunc reads gitdomain.ProposalBodyFile from the CLI args.

type ReadProposalBodyFlagFunc

type ReadProposalBodyFlagFunc func(*cobra.Command) (Option[gitdomain.ProposalBody], error)

ReadCommitMessageFlagFunc defines the type signature for helper functions that provide the value a string CLI flag associated with a Cobra command.

type ReadProposalTitleFlagFunc

type ReadProposalTitleFlagFunc func(*cobra.Command) (Option[gitdomain.ProposalTitle], error)

ReadCommitMessageFlagFunc defines the type signature for helper functions that provide the value a string CLI flag associated with a Cobra command.

type ReadProposeFlagFunc

type ReadProposeFlagFunc func(*cobra.Command) (configdomain.Propose, error)

ReadProposeFlagFunc is the type signature for the function that reads the "propose" flag from the args to the given Cobra command.

type ReadPrototypeFlagFunc

type ReadPrototypeFlagFunc func(*cobra.Command) (configdomain.Prototype, error)

ReadPrototypeFlagFunc is the type signature for the function that reads the "prototype" flag from the args to the given Cobra command.

type ReadPruneFlagFunc

type ReadPruneFlagFunc func(*cobra.Command) (configdomain.Prune, error)

ReadPruneFlagFunc is the type signature for the function that reads the "prune" flag from the args to the given Cobra command.

type ReadPushFlagFunc

type ReadPushFlagFunc func(*cobra.Command) (Option[configdomain.PushBranches], error)

ReadPushFlagFunc is the type signature for the function that reads the "no-push" flag from the args to the given Cobra command.

type ReadRedactFlagFunc

type ReadRedactFlagFunc func(*cobra.Command) (configdomain.Redact, error)

ReadRedactFlagFunc is the type signature for the function that reads the "redact" flag from the args to the given Cobra command.

type ReadShipIntoNonPerennialParentFlagFunc

type ReadShipIntoNonPerennialParentFlagFunc func(*cobra.Command) (configdomain.ShipIntoNonperennialParent, error)

ReadShipIntoNonPerennialParentFlagFunc is the type signature for the function that reads the "to-parent" flag from the args to the given Cobra command.

type ReadShipStrategyFunc

type ReadShipStrategyFunc func(*cobra.Command) (Option[configdomain.ShipStrategy], error)

ReadShipStrategyFunc is the type signature for the function that reads the ship "strategy" flag from the args to the given Cobra command.

type ReadStackFlagFunc

type ReadStackFlagFunc func(*cobra.Command) (configdomain.FullStack, error)

type ReadStashFlagFunc

type ReadStashFlagFunc func(*cobra.Command) (Option[configdomain.Stash], error)

type ReadSyncFlagFunc

type ReadSyncFlagFunc func(*cobra.Command) (Option[configdomain.AutoSync], error)

type ReadTypeFlagFunc

type ReadTypeFlagFunc func(*cobra.Command) ([]configdomain.BranchType, error)

ReadTypeFlagFunc is the type signature for the function that reads the "type" flag from the args to the given Cobra command.

type ReadUpFlagFunc

type ReadUpFlagFunc func(*cobra.Command) (Option[configdomain.Up], error)

ReadUpFlagFunc is the type signature for the function that reads the "up" flag from the args to the given Cobra command.

type ReadVerboseFlagFunc

type ReadVerboseFlagFunc func(*cobra.Command) (Option[configdomain.Verbose], error)

ReadVerboseFlagFunc is the type signature for the function that reads the "verbose" flag from the args to the given Cobra command.

Jump to

Keyboard shortcuts

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