ctxutil

package
v1.12.9 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAlias added in v1.8.4

func GetAlias(ctx context.Context) string

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

func GetCommitMessage added in v1.12.9

func GetCommitMessage(ctx context.Context) string

GetCommitMessage returns the set commit message or an empty string

func GetCommitTimestamp added in v1.12.9

func GetCommitTimestamp(ctx context.Context) time.Time

GetCommitTimestamp returns the commit timestamp from the context if set or the default (now) otherwise.

func GetEmail added in v1.12.9

func GetEmail(ctx context.Context) string

GetEmail returns the email from the context

func GetImportFunc added in v1.12.9

func GetImportFunc(ctx context.Context) store.ImportCallback

GetImportFunc will return the import callback or a default one returning true Note: will never return nil

func GetUsername added in v1.12.9

func GetUsername(ctx context.Context) string

GetUsername returns the username from the context

func HasAlias added in v1.8.4

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 HasCommitMessage added in v1.12.9

func HasCommitMessage(ctx context.Context) bool

HasCommitMessage returns true if the commit message was set

func HasCommitTimestamp added in v1.12.9

func HasCommitTimestamp(ctx context.Context) bool

HasCommitTimestamp returns true if the value for the commit timestamp was set in the context.

func HasExportKeys added in v1.12.9

func HasExportKeys(ctx context.Context) bool

HasExportKeys returns true if Export Keys was set in the context.

func HasForce added in v1.8.6

func HasForce(ctx context.Context) bool

HasForce returns true if the context has the force flag set

func HasGitCommit

func HasGitCommit(ctx context.Context) bool

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

func HasGitInit added in v1.8.5

func HasGitInit(ctx context.Context) bool

HasGitInit returns true if the git init flag was set.

func HasImportFunc added in v1.12.9

func HasImportFunc(ctx context.Context) bool

HasImportFunc returns true if a value for import func has been set in this context

func HasInteractive

func HasInteractive(ctx context.Context) bool

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

func HasNoNetwork added in v1.12.9

func HasNoNetwork(ctx context.Context) bool

HasNoNetwork returns true if no network was set

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 HasPasswordCallback added in v1.12.9

func HasPasswordCallback(ctx context.Context) bool

HasPasswordCallback returns true if a password callback was set in the context

func HasProgressCallback added in v1.8.2

func HasProgressCallback(ctx context.Context) bool

HasProgressCallback returns true if a ProgressCallback has been set

func HasShowParsing added in v1.12.9

func HasShowParsing(ctx context.Context) bool

HasShowParsing returns true if a value for ShowParsing has been set in this context

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 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 IsExportKeys added in v1.12.9

func IsExportKeys(ctx context.Context) bool

IsExportKeys returns the value of export keys or the default (true).

func IsForce added in v1.8.6

func IsForce(ctx context.Context) bool

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

func IsGitCommit

func IsGitCommit(ctx context.Context) bool

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

func IsGitInit added in v1.8.5

func IsGitInit(ctx context.Context) bool

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

func IsHidden added in v1.12.9

func IsHidden(ctx context.Context) bool

IsHidden returns true if any output should be hidden in this context

func IsInteractive

func IsInteractive(ctx context.Context) bool

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

func IsNoNetwork added in v1.12.9

func IsNoNetwork(ctx context.Context) bool

IsNoNetwork returns the value of no network or false

func IsNoPager

func IsNoPager(ctx context.Context) bool

IsNoPager returns the value of pager or the default (false)

func IsNotifications

func IsNotifications(ctx context.Context) bool

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

func IsShowParsing added in v1.12.9

func IsShowParsing(ctx context.Context) bool

IsShowParsing returns the value of ShowParsing 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 IsVerbose

func IsVerbose(ctx context.Context) bool

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

func WithAlias added in v1.8.4

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 WithCommitMessage added in v1.12.9

func WithCommitMessage(ctx context.Context, sv string) context.Context

WithCommitMessage returns a context with a commit message set

func WithCommitTimestamp added in v1.12.9

func WithCommitTimestamp(ctx context.Context, ts time.Time) context.Context

WithCommitTimestamp returns a context with the value for the commit timestamp set.

func WithEmail added in v1.12.9

func WithEmail(ctx context.Context, sv string) context.Context

WithEmail returns a context with the email set in the context

func WithExportKeys added in v1.12.9

func WithExportKeys(ctx context.Context, d bool) context.Context

WithExportKeys returns a context with the value for export keys set.

func WithForce added in v1.8.6

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

WithForce returns a context with the force flag 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 added in v1.8.5

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

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

func WithGlobalFlags added in v1.12.9

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

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

func WithHidden added in v1.12.9

func WithHidden(ctx context.Context, hidden bool) context.Context

WithHidden returns a context with the flag value for hidden set

func WithImportFunc added in v1.12.9

func WithImportFunc(ctx context.Context, imf store.ImportCallback) context.Context

WithImportFunc will return a context with the import callback set

func WithInteractive

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

WithInteractive returns a context with an explicit value for interactive

func WithNoNetwork added in v1.12.9

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

WithNoNetwork returns a context with the value of no network set

func WithNoPager

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

WithNoPager returns a context with the value for pager set

func WithNotifications

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

WithNotifications returns a context with the value for Notifications set

func WithPasswordCallback added in v1.12.9

func WithPasswordCallback(ctx context.Context, cb PasswordCallback) context.Context

WithPasswordCallback returns a context with the password callback set

func WithProgressCallback added in v1.8.2

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

WithProgressCallback returns a context with the value of ProgressCallback set

func WithShowParsing added in v1.12.9

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

WithShowParsing returns a context with the value for ShowParsing 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 WithUsername added in v1.12.9

func WithUsername(ctx context.Context, sv string) context.Context

WithUsername returns a context with the username set in the context

func WithVerbose

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

WithVerbose returns a context with the value for verbose set

Types

type PasswordCallback added in v1.12.9

type PasswordCallback func(string, bool) ([]byte, error)

PasswordCallback is a password prompt callback

func GetPasswordCallback added in v1.12.9

func GetPasswordCallback(ctx context.Context) PasswordCallback

GetPasswordCallback returns the password callback or a default (which always fails)

type ProgressCallback added in v1.8.2

type ProgressCallback func()

ProgressCallback is a callback for updateing progress

func GetProgressCallback added in v1.8.2

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