Documentation
¶
Index ¶
- func Error(text string) string
- func Execute() error
- func Info(text string) string
- func Primary(text string) string
- func ResolveProjectContext(homeDir, repoDir, projectFlag string) (*project.ProjectEntry, error)
- func SetVersionInfo(version string)
- func Silent(text string) string
- func Text(text string) string
- func Warning(text string) string
- type BoolFlag
- type ConfirmFunc
- type GitReflogFunc
- type GroupCommand
- type LeafCommand
- type MultiSelectFunc
- type ProjectEntries
- type PromptFunc
- type PromptKit
- type PromptWithDefaultFunc
- type SelectFunc
- type StringFlag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveProjectContext ¶
func ResolveProjectContext(homeDir, repoDir, projectFlag string) (*project.ProjectEntry, error)
ResolveProjectContext finds the active project using the --project flag or the current repo's .git/.hourgit config.
func SetVersionInfo ¶
func SetVersionInfo(version string)
Types ¶
type ConfirmFunc ¶
ConfirmFunc prompts the user for confirmation and returns true if confirmed.
func NewConfirmFunc ¶
func NewConfirmFunc() ConfirmFunc
NewConfirmFunc creates a ConfirmFunc using huh's interactive confirm component.
func ResolveConfirmFunc ¶
func ResolveConfirmFunc(yes bool) ConfirmFunc
ResolveConfirmFunc returns AlwaysYes() if yes is true, otherwise NewConfirmFunc().
type GitReflogFunc ¶
GitReflogFunc executes git reflog and returns its output. The since parameter is non-nil when LastSync is available.
type GroupCommand ¶
GroupCommand defines a command that only holds subcommands.
func (GroupCommand) Build ¶
func (gc GroupCommand) Build() *cobra.Command
Build creates a cobra.Command with all subcommands registered.
type LeafCommand ¶
type LeafCommand struct {
Use string
Short string
Args cobra.PositionalArgs
BoolFlags []BoolFlag
StrFlags []StringFlag
RunE func(cmd *cobra.Command, args []string) error
}
LeafCommand defines a command that executes logic. Every leaf command file must declare one of these and call Build().
func (LeafCommand) Build ¶
func (lc LeafCommand) Build() *cobra.Command
Build creates a cobra.Command with all flags registered.
type MultiSelectFunc ¶
MultiSelectFunc prompts the user to select multiple options. Returns 0-based indices.
func NewMultiSelectFunc ¶
func NewMultiSelectFunc() MultiSelectFunc
NewMultiSelectFunc creates a MultiSelectFunc using huh's interactive multi-select component.
type ProjectEntries ¶ added in v0.8.0
type ProjectEntries struct {
Checkouts []entry.CheckoutEntry
Logs []entry.Entry
Commits []entry.CommitEntry
ActivityStops []entry.ActivityStopEntry
ActivityStarts []entry.ActivityStartEntry
}
ProjectEntries holds all entry types for a project.
func LoadProjectEntries ¶ added in v0.8.0
func LoadProjectEntries(homeDir, slug string) (ProjectEntries, error)
LoadProjectEntries reads all 5 entry types for a project in one call.
type PromptFunc ¶
PromptFunc prompts the user for free-text input and returns the response.
func NewPromptFunc ¶
func NewPromptFunc() PromptFunc
NewPromptFunc creates a PromptFunc using huh's interactive input component.
type PromptKit ¶
type PromptKit struct {
Prompt PromptFunc
PromptWithDefault PromptWithDefaultFunc
Confirm ConfirmFunc
Select SelectFunc
MultiSelect MultiSelectFunc
}
PromptKit bundles all prompt function types for dependency injection.
func NewPromptKit ¶
func NewPromptKit() PromptKit
NewPromptKit creates a PromptKit with huh-based interactive implementations.
type PromptWithDefaultFunc ¶
PromptWithDefaultFunc prompts the user for input with a pre-filled default value.
func NewPromptWithDefaultFunc ¶
func NewPromptWithDefaultFunc() PromptWithDefaultFunc
NewPromptWithDefaultFunc creates a PromptWithDefaultFunc using huh's interactive input.
type SelectFunc ¶
SelectFunc prompts the user to select one option from a list. Returns 0-based index.
func NewSelectFunc ¶
func NewSelectFunc() SelectFunc
NewSelectFunc creates a SelectFunc using huh's interactive select component.
func ResolveSelectFunc ¶
func ResolveSelectFunc(yes bool) SelectFunc
ResolveSelectFunc returns a SelectFunc that always picks the first option if yes is true, otherwise returns an interactive SelectFunc.
Source Files
¶
- color.go
- command.go
- completion.go
- completion_install.go
- completion_install_cmd.go
- defaults.go
- defaults_schedule.go
- defaults_schedule_get.go
- defaults_schedule_report.go
- defaults_schedule_reset.go
- defaults_schedule_set.go
- entries.go
- help.go
- history.go
- init.go
- log.go
- log_add.go
- log_edit.go
- log_remove.go
- mode.go
- project.go
- project_add.go
- project_assign.go
- project_edit.go
- project_list.go
- project_remove.go
- prompt.go
- report.go
- report_export.go
- report_overlay.go
- report_table.go
- report_table_update.go
- report_table_view.go
- resolve.go
- root.go
- schedule_builder.go
- schedule_cmd.go
- schedule_get.go
- schedule_report.go
- schedule_report_cmd.go
- schedule_reset.go
- schedule_set.go
- status.go
- sync.go
- update.go
- update_cmd.go
- version.go
- watch.go
- watcher_check.go