Documentation ¶
Index ¶
- Constants
- func AddProjectFlags(cmd *cobra.Command, f Factory)
- func GetWeekdays() []string
- func RequiredNamedArgs(names ...string) cobra.PositionalArgs
- func XorFlag(exclusiveFlags map[string]bool) error
- func XorFlagSet(f *pflag.FlagSet, exclusiveFlags ...string) error
- type Config
- type Factory
- type FlagError
- type Version
Constants ¶
View Source
const ( CONF_WORKWEEK_DAYS = "workweek-days" CONF_INTERACTIVE = "interactive" CONF_ALLOW_NAME_FOR_ID = "allow-name-for-id" CONF_SEARCH_PROJECTS_WITH_CLIENT_NAME = "search-project-with-client" CONF_USER_ID = "user.id" CONF_WORKSPACE = "workspace" CONF_TOKEN = "token" CONF_ALLOW_INCOMPLETE = "allow-incomplete" CONF_SHOW_TASKS = "show-task" CONF_SHOW_CLIENT = "show-client" 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" CONF_INTERACTIVE_PAGE_SIZE = "interactive-page-size" )
View Source
const ( LOG_LEVEL_NONE = "none" LOG_LEVEL_DEBUG = "debug" LOG_LEVEL_INFO = "info" )
Variables ¶
This section is empty.
Functions ¶
func AddProjectFlags ¶
AddProjectFlags creates a project flag with autocomplete configured
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
Types ¶
type Config ¶
type Config interface { // GetBool retrieves a config by its name as a bool GetBool(string) bool // SetBool changes a bool config by its name SetBool(string, bool) // GetInt retrieves a config by its name as a int GetInt(string) int // SetInt changes a int config by its name SetInt(string, int) // GetString retrieves a config by its name as a string GetString(string) string // SetString changes a string config by its name SetString(string, string) // SetStringSlice retrieves a config by its name as a []string GetStringSlice(string) []string // SetStringSlice changes a []string config by its name SetStringSlice(string, []string) // IsDebuging configures CLI to log most of the data being used IsDebuging() bool // IsAllowNameForID configures the CLI to lookup entities ids by their name IsAllowNameForID() bool // IsInteractive configures the CLI to prompt the user interactively IsInteractive() bool // GetWorkWeekdays set which days of the week the user is expected to work GetWorkWeekdays() []string // InteractivePageSize sets how many items are shown when prompting // projects InteractivePageSize() int // IsSearchProjectWithClientsName defines if the project name for ID should // include the client's name IsSearchProjectWithClientsName() bool // Get retrieves a config by its name Get(string) interface{} // All retrieves all the configurations of the CLI as a map All() map[string]interface{} // LogLevel sets how much should be logged during execution LogLevel() string // Save will persist the changes made to the configuration Save() error }
Config manages configs and parameters used locally by the CLI
type Factory ¶
type Factory interface { // Version of the CLI Version() Version // Config returns configurations set by the user Config() Config // Client builds a client for Clockify's API Client() (api.Client, error) // UI builds a control to prompt information from the user UI() ui.UI // GetUserID returns the current user id GetUserID() (string, error) // GetWorkspaceID returns the current workspace id GetWorkspaceID() (string, error) // GetWorkspaceID returns the current workspace GetWorkspace() (dto.Workspace, error) }
Factory is a container/factory builder for the commands and its helpers
func NewFactory ¶
type FlagError ¶
type FlagError struct {
// contains filtered or unexported fields
}
FlagError happens when a non-cobra validation fails
func FlagErrorWrap ¶
Click to show internal directories.
Click to hide internal directories.