ctxutil

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: MIT Imports: 2 Imported by: 208

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAlias

func GetAlias(ctx context.Context) string

GetAlias returns an alias if it has been set or an empty string otherwise.

func GetClipTimeout

func GetClipTimeout(ctx context.Context) int

GetClipTimeout returns the value of clip timeout or the default (45)

func GetConcurrency

func GetConcurrency(ctx context.Context) int

GetConcurrency returns the value of concurrent threads or the default (1)

func GetConfigDir added in v1.8.4

func GetConfigDir(ctx context.Context) string

GetConfigDir returns the config dir if set or an empty string.

func HasAlias

func HasAlias(ctx context.Context) bool

HasAlias returns true if a value for alias has been set.

func HasAlwaysYes

func HasAlwaysYes(ctx context.Context) bool

HasAlwaysYes returns true if a value for AlwaysYes has been set in this context

func HasAskForMore added in v1.7.0

func HasAskForMore(ctx context.Context) bool

HasAskForMore returns true if a value for AskForMore has been set in this context

func HasAutoClip

func HasAutoClip(ctx context.Context) bool

HasAutoClip returns true if a value for AutoClip has been set in this context

func HasAutoPrint added in v1.8.5

func HasAutoPrint(ctx context.Context) bool

HasAutoPrint returns true if a specific value for auto print was set.

func HasClipTimeout

func HasClipTimeout(ctx context.Context) bool

HasClipTimeout returns true if a value for ClipTimeout has been set in this context

func HasColor

func HasColor(ctx context.Context) bool

HasColor returns true if a value for Color has been set in this context

func HasConcurrency

func HasConcurrency(ctx context.Context) bool

HasConcurrency returns true if a value for Concurrency has been set in this context and is bigger than 1 since if it is equal to 1, we are not working concurrently.

func HasConfigDir added in v1.8.4

func HasConfigDir(ctx context.Context) bool

HasConfigDir returns true if a config dir has been set.

func HasDebug added in v1.7.0

func HasDebug(ctx context.Context) bool

HasDebug returns true if a value for debug has been set in this context

func HasEditRecipients added in v1.7.0

func HasEditRecipients(ctx context.Context) bool

HasEditRecipients returns true if a value for EditRecipients has been set in this context

func HasForce

func HasForce(ctx context.Context) bool

HasForce returns true if the context has the force flag set

func HasFuzzySearch

func HasFuzzySearch(ctx context.Context) bool

HasFuzzySearch returns true if a value for FuzzySearch has been set in this context

func HasGitCommit

func HasGitCommit(ctx context.Context) bool

HasGitCommit returns true if a value for GitCommit has been set in this context

func HasGitInit

func HasGitInit(ctx context.Context) bool

HasGitInit returns true if the git init flag was set.

func HasInteractive

func HasInteractive(ctx context.Context) bool

HasInteractive returns true if a value for Interactive has been set in this context

func HasNoColor

func HasNoColor(ctx context.Context) bool

HasNoColor returns true if a value for NoColor has been set in this context

func HasNoConfirm added in v1.7.0

func HasNoConfirm(ctx context.Context) bool

HasNoConfirm returns true if a value for NoConfirm has been set in this context

func HasNoPager

func HasNoPager(ctx context.Context) bool

HasNoPager returns true if a value for NoPager has been set in this context

func HasNotifications

func HasNotifications(ctx context.Context) bool

HasNotifications returns true if a value for Notifications has been set in this context

func HasProgressCallback

func HasProgressCallback(ctx context.Context) bool

HasProgressCallback returns true if a ProgressCallback has been set

func HasShowSafeContent

func HasShowSafeContent(ctx context.Context) bool

HasShowSafeContent returns true if a value for ShowSafeContent has been set in this context

func HasStdin

func HasStdin(ctx context.Context) bool

HasStdin returns true if a value for Stdin has been set in this context

func HasTerminal

func HasTerminal(ctx context.Context) bool

HasTerminal returns true if a value for Terminal has been set in this context

func HasUseSymbols added in v1.7.0

func HasUseSymbols(ctx context.Context) bool

HasUseSymbols returns true if a value for UseSymbols has been set in this context

func HasVerbose

func HasVerbose(ctx context.Context) bool

HasVerbose returns true if a value for Verbose has been set in this context

func IsAlwaysYes

func IsAlwaysYes(ctx context.Context) bool

IsAlwaysYes returns the value of always yes or the default (false)

func IsAskForMore added in v1.7.0

func IsAskForMore(ctx context.Context) bool

IsAskForMore returns the value of ask for more or the default (false)

func IsAutoClip

func IsAutoClip(ctx context.Context) bool

IsAutoClip returns the value of AutoClip or the default (true)

func IsAutoPrint added in v1.8.5

func IsAutoPrint(ctx context.Context) bool

IsAutoPrint returns the value of auto print or false if none was set.

func IsColor

func IsColor(ctx context.Context) bool

IsColor returns the value of color or the default (true)

func IsDebug added in v1.7.0

func IsDebug(ctx context.Context) bool

IsDebug returns the value of debug or the default (false)

func IsEditRecipients added in v1.7.0

func IsEditRecipients(ctx context.Context) bool

IsEditRecipients returns the value of EditRecipients or the default (false)

func IsForce

func IsForce(ctx context.Context) bool

IsForce returns the force flag value of the default (false)

func IsFuzzySearch

func IsFuzzySearch(ctx context.Context) bool

IsFuzzySearch return the value of fuzzy search or the default (true)

func IsGitCommit

func IsGitCommit(ctx context.Context) bool

IsGitCommit returns the value of git commit or the default (true)

func IsGitInit

func IsGitInit(ctx context.Context) bool

IsGitInit returns the value of the git init flag or ture if none was set.

func IsInteractive

func IsInteractive(ctx context.Context) bool

IsInteractive returns the value of interactive or the default (true)

func IsNoColor

func IsNoColor(ctx context.Context) bool

IsNoColor returns the value of ask for more or the default (false)

func IsNoConfirm added in v1.7.0

func IsNoConfirm(ctx context.Context) bool

IsNoConfirm returns the value of ask for more or the default (false)

func IsNoPager

func IsNoPager(ctx context.Context) bool

IsNoPager returns the value of ask for more or the default (false)

func IsNotifications

func IsNotifications(ctx context.Context) bool

IsNotifications returns the value of Notifications or the default (true)

func IsShowSafeContent

func IsShowSafeContent(ctx context.Context) bool

IsShowSafeContent returns the value of ShowSafeContent or the default (false)

func IsStdin

func IsStdin(ctx context.Context) bool

IsStdin returns the value of stdin, i.e. if it's true some data is being piped to stdin. If not set it returns the default value (false)

func IsTerminal

func IsTerminal(ctx context.Context) bool

IsTerminal returns the value of terminal or the default (true)

func IsUseSymbols added in v1.7.0

func IsUseSymbols(ctx context.Context) bool

IsUseSymbols returns the value of ask for more or the default (false)

func IsVerbose

func IsVerbose(ctx context.Context) bool

IsVerbose returns the value of verbose or the default (false)

func WithAlias

func WithAlias(ctx context.Context, alias string) context.Context

WithAlias returns an context with the alias set.

func WithAlwaysYes

func WithAlwaysYes(ctx context.Context, bv bool) context.Context

WithAlwaysYes returns a context with the value of always yes set

func WithAskForMore added in v1.7.0

func WithAskForMore(ctx context.Context, afm bool) context.Context

WithAskForMore returns a context with the value for ask for more set

func WithAutoClip

func WithAutoClip(ctx context.Context, bv bool) context.Context

WithAutoClip returns a context with the value for AutoClip set

func WithAutoPrint added in v1.8.5

func WithAutoPrint(ctx context.Context, bv bool) context.Context

WithAutoPrint returns a context with the value for auto print set.

func WithClipTimeout

func WithClipTimeout(ctx context.Context, to int) context.Context

WithClipTimeout returns a context with the value for clip timeout set

func WithColor

func WithColor(ctx context.Context, color bool) context.Context

WithColor returns a context with an explicit value for color

func WithConcurrency

func WithConcurrency(ctx context.Context, to int) context.Context

WithConcurrency returns a context with the value for clip timeout set

func WithConfigDir added in v1.8.4

func WithConfigDir(ctx context.Context, cfgdir string) context.Context

WithConfigDir returns a context with the config dir set.

func WithDebug added in v1.7.0

func WithDebug(ctx context.Context, dbg bool) context.Context

WithDebug returns a context with an explicit value for debug

func WithEditRecipients added in v1.7.0

func WithEditRecipients(ctx context.Context, bv bool) context.Context

WithEditRecipients returns a context with the value for EditRecipients set

func WithForce

func WithForce(ctx context.Context, bv bool) context.Context

WithForce returns a context with the force flag set

func WithFuzzySearch

func WithFuzzySearch(ctx context.Context, fuzzy bool) context.Context

WithFuzzySearch returns a context with the value for fuzzy search set

func WithGitCommit

func WithGitCommit(ctx context.Context, bv bool) context.Context

WithGitCommit returns a context with the value of git commit set

func WithGitInit

func WithGitInit(ctx context.Context, bv bool) context.Context

WithGitInit returns a context with the value for the git init flag set.

func WithGlobalFlags

func WithGlobalFlags(c *cli.Context) context.Context

WithGlobalFlags parses any global flags from the cli context and returns a regular context

func WithInteractive

func WithInteractive(ctx context.Context, isInteractive bool) context.Context

WithInteractive returns a context with an explicit value for interactive

func WithNoColor

func WithNoColor(ctx context.Context, bv bool) context.Context

WithNoColor returns a context with the value for ask for more set

func WithNoConfirm added in v1.7.0

func WithNoConfirm(ctx context.Context, bv bool) context.Context

WithNoConfirm returns a context with the value for ask for more set

func WithNoPager

func WithNoPager(ctx context.Context, bv bool) context.Context

WithNoPager returns a context with the value for ask for more set

func WithNotifications

func WithNotifications(ctx context.Context, verbose bool) context.Context

WithNotifications returns a context with the value for Notifications set

func WithProgressCallback

func WithProgressCallback(ctx context.Context, cb ProgressCallback) context.Context

WithProgressCallback returns a context with the value of ProgressCallback set

func WithShowSafeContent

func WithShowSafeContent(ctx context.Context, bv bool) context.Context

WithShowSafeContent returns a context with the value for ShowSafeContent set

func WithStdin

func WithStdin(ctx context.Context, isStdin bool) context.Context

WithStdin returns a context with the value for Stdin set. If true some input is available on Stdin (e.g. something is being piped into it)

func WithTerminal

func WithTerminal(ctx context.Context, isTerm bool) context.Context

WithTerminal returns a context with an explicit value for terminal

func WithUseSymbols added in v1.7.0

func WithUseSymbols(ctx context.Context, bv bool) context.Context

WithUseSymbols returns a context with the value for ask for more set

func WithVerbose

func WithVerbose(ctx context.Context, verbose bool) context.Context

WithVerbose returns a context with the value for verbose set

Types

type ProgressCallback

type ProgressCallback func()

ProgressCallback is a callback for updateing progress

func GetProgressCallback

func GetProgressCallback(ctx context.Context) ProgressCallback

GetProgressCallback return the set progress callback or a default one. It never returns nil

Jump to

Keyboard shortcuts

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