cmdutil

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONF_WORKWEEK_DAYS       = "workweek-days"
	CONF_INTERACTIVE         = "interactive"
	CONF_ALLOW_NAME_FOR_ID   = "allow-name-for-id"
	CONF_USER_ID             = "user.id"
	CONF_WORKSPACE           = "workspace"
	CONF_TOKEN               = "token"
	CONF_ALLOW_INCOMPLETE    = "allow-incomplete"
	CONF_SHOW_TASKS          = "show-task"
	CONF_DESCR_AUTOCOMP      = "description-autocomplete"
	CONF_DESCR_AUTOCOMP_DAYS = "description-autocomplete-days"
	CONF_SHOW_TOTAL_DURATION = "show-total-duration"
	CONF_LOG_LEVEL           = "log-level"
	CONF_ALLOW_ARCHIVED_TAGS = "allow-archived-tags"
)
View Source
const (
	LOG_LEVEL_NONE  = "none"
	LOG_LEVEL_DEBUG = "debug"
	LOG_LEVEL_INFO  = "info"
)

Variables

This section is empty.

Functions

func AddProjectFlags

func AddProjectFlags(cmd *cobra.Command, f Factory)

AddProjectFlags creates a project flag with autocomplete configured

func GetWeekdays

func GetWeekdays() []string

GetWeekdays with their names

func RequiredNamedArgs

func RequiredNamedArgs(names ...string) cobra.PositionalArgs

RequiredNamedArgs will fail if the number of arguments received is less than the length of the parameter `names`, and will show the help explaining required named arguments

func XorFlag

func XorFlag(exclusiveFlags map[string]bool) error

XorFlag will fail if 2 or more entries are true

func XorFlagSet added in v0.40.0

func XorFlagSet(f *pflag.FlagSet, exclusiveFlags ...string) error

XorFlagSet works like XorFlag, but will read if the flag was changed from the pflag.FlagSet

Types

type Config

type Config interface {
	GetBool(string) bool
	SetBool(string, bool)

	GetInt(string) int
	SetInt(string, int)

	GetString(string) string
	SetString(string, string)

	GetStringSlice(string) []string
	SetStringSlice(string, []string)

	IsDebuging() bool
	IsAllowNameForID() bool
	IsInteractive() bool
	GetWorkWeekdays() []string

	Get(string) interface{}
	All() map[string]interface{}

	LogLevel() string

	Save() error
}

Config manages configs and parameters used locally by the CLI

type Factory

type Factory interface {
	Version() Version
	Config() Config
	Client() (api.Client, error)
	GetUserID() (string, error)
	GetWorkspaceID() (string, error)
	GetWorkspace() (dto.Workspace, error)
}

Factory is a container/factory builder for the commands and its helpers

func NewFactory

func NewFactory(v Version) Factory

type FlagError

type FlagError struct {
	// contains filtered or unexported fields
}

FlagError happens when a non-cobra validation fails

func FlagErrorWrap

func FlagErrorWrap(err error) *FlagError

func (*FlagError) Error

func (fe *FlagError) Error() string

func (*FlagError) Unwrap

func (fe *FlagError) Unwrap() error

type Version

type Version struct {
	Tag    string
	Commit string
	Date   string
}

Version register which is the CLI tag, commit and build date

Jump to

Keyboard shortcuts

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