Documentation
¶
Index ¶
- Variables
- func ApplySeeAlso(cmd *cobra.Command)
- func IngestRemote(db *database.DB, remoteName string, remoteConfig config_pkg.RemoteConfig) error
- func LoadJSON[T any](path string) (*T, error)
- func PrintDoctorReport(w io.Writer, report *DoctorReport)
- func SaveJSON[T any](path string, data *T) error
- func SeeAlso(commands ...string) string
- func SeeAlsoWithDescriptions(root *cobra.Command, commands ...string) string
- func TestColorizeStatus(t *testing.T)
- func TestExtractPrefix(t *testing.T)
- func TestGetCurrentUser(t *testing.T)
- func ValidateSeeAlso(root *cobra.Command) error
- type ColumnConstraints
- type ColumnWidths
- type ContainerKindExport
- type DoctorCollision
- type DoctorReport
- type SchemaExport
Constants ¶
This section is empty.
Variables ¶
var RootCmd = &cobra.Command{ Use: "tk", Short: "tk - system-wide event-sourced task tracker", Long: `tk is a command-line tool that tracks tasks system-wide using an append-only event log in a single SQLite database.`, PersistentPreRun: func(cmd *cobra.Command, args []string) { if debugFlag { slog.SetDefault(slog.New( devslog.NewHandler(os.Stderr, &devslog.Options{ HandlerOptions: &slog.HandlerOptions{Level: slog.LevelDebug}, NewLineAfterLog: true, }), )) slog.Debug("debug logging enabled") } }, Args: cobra.ArbitraryArgs, RunE: func(cmd *cobra.Command, args []string) error { if len(args) > 0 && len(args[0]) > 0 && args[0][0] == '/' { return queryCmd.RunE(cmd, args) } return cmd.Help() }, }
Functions ¶
func ApplySeeAlso ¶
ApplySeeAlso adds "See Also" sections to commands based on the registry. It recursively applies to all subcommands as well.
This should be called once on the root command after all commands have been registered.
By default, this shows just command names. To include descriptions from each command's Short field, change the function call from:
SeeAlso(related...)
to:
SeeAlsoWithDescriptions(cmd.Root(), related...)
func IngestRemote ¶
func IngestRemote(db *database.DB, remoteName string, remoteConfig config_pkg.RemoteConfig) error
IngestRemote is kept for backward compatibility with cmd/sync.go New code should use remote.IngestRemote directly
func PrintDoctorReport ¶
func PrintDoctorReport(w io.Writer, report *DoctorReport)
func SeeAlso ¶
SeeAlso formats a "See Also" section for command help text. It takes a list of command paths and returns a formatted string that can be appended to a command's Long field.
By default, this only shows command names. To include descriptions from Cobra commands, use SeeAlsoWithDescriptions instead.
func SeeAlsoWithDescriptions ¶
SeeAlsoWithDescriptions formats a "See Also" section with descriptions pulled from the Cobra command's Short field.
This avoids duplication by reusing the descriptions already defined in each command. Commands that don't exist or have no Short description will be shown without a description.
func TestColorizeStatus ¶
func TestExtractPrefix ¶
func TestGetCurrentUser ¶
func ValidateSeeAlso ¶
ValidateSeeAlso checks that all commands referenced in the registry actually exist in the command tree.
This function is intended for use in tests only, not at runtime. It uses Cobra's Find() method to verify command existence.
Returns an error if any referenced command doesn't exist, or if a source command in the registry doesn't exist.
Types ¶
type ColumnConstraints ¶
type ColumnConstraints struct {
TermWidth int
ShowAliases bool
LabelsMaxWidth int
TitleMinWidth int
SeparatorWidth int // Width of " │ " separator between columns
PaddingPerCell int // Additional padding within each cell
}
ColumnConstraints defines the constraints for column sizing
func DefaultColumnConstraints ¶
func DefaultColumnConstraints(termWidth int, showAliases bool) ColumnConstraints
DefaultColumnConstraints returns sensible defaults
type ColumnWidths ¶
type ColumnWidths struct {
ID int
Aliases int
Kind int
Status int
Priority int
Labels int
Title int
HasAliases bool
}
ColumnWidths holds the calculated widths for table columns
func CalculateColumnWidths ¶
func CalculateColumnWidths(tasks []*types.Task, displayIDs map[string]string, constraints ColumnConstraints) ColumnWidths
CalculateColumnWidths computes optimal column widths based on actual task data
type ContainerKindExport ¶
type ContainerKindExport struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
}
ContainerKindExport represents a container kind in the export
type DoctorCollision ¶
type DoctorCollision struct {
ProjectUID string
ProjectAlias string
Number int64
TaskDisplayIDs []string
}
func GetNumberCollisions ¶
func GetNumberCollisions(db *database.DB, projectFilter string) ([]DoctorCollision, error)
GetNumberCollisions finds task number collisions (exported for cmd package)
type DoctorReport ¶
type DoctorReport struct {
Issues []string
InvalidEvents []string
Collisions []DoctorCollision
}
func (*DoctorReport) ProblemCount ¶
func (r *DoctorReport) ProblemCount() int
type SchemaExport ¶
type SchemaExport struct {
QueueKinds []ContainerKindExport `json:"queue_kinds"`
StackKinds []ContainerKindExport `json:"stack_kinds"`
GroupKinds []ContainerKindExport `json:"group_kinds"`
}
SchemaExport represents the exported schema structure
Source Files
¶
- actions.go
- attach.go
- column_width.go
- debug_doctor.go
- debug_events_ls.go
- debug_events_show.go
- debug_events_stats.go
- debug_helpers.go
- debug_id.go
- debug_node_regen.go
- debug_node_show.go
- debug_rebuild.go
- debug_repair.go
- debug_sanitycheck.go
- describe.go
- display.go
- edit.go
- group_addtask.go
- group_create.go
- group_delete.go
- group_ls.go
- group_rename.go
- group_rmtask.go
- group_show.go
- help.go
- help_registry.go
- history.go
- ingest.go
- init.go
- json_persistence.go
- log_query.go
- log_search.go
- ls.go
- mark.go
- mcp.go
- meta_claims.go
- meta_get.go
- meta_ls.go
- meta_set.go
- migrate_fix_container_item_ids.go
- migrate_fix_relocate_bug.go
- migrate_scan_deprecated.go
- mv.go
- new.go
- note.go
- path.go
- project_create.go
- project_ls.go
- project_rename.go
- project_rm.go
- query.go
- queue_create.go
- queue_ls.go
- queue_pop.go
- queue_push.go
- queue_rename.go
- queue_rm.go
- queue_show.go
- relate_add.go
- relate_blocked.go
- relate_blockers.go
- relate_conflicts.go
- relate_dup.go
- relate_graph.go
- relate_ls.go
- relate_rm.go
- remote_add.go
- remote_ls.go
- remote_rm.go
- rm.go
- root.go
- schema_add.go
- schema_export.go
- schema_ls.go
- show.go
- stack_create.go
- stack_ls.go
- stack_pop.go
- stack_push.go
- stack_rename.go
- stack_rm.go
- stack_show.go
- statusline.go
- sync.go
- sync_status.go
- task_conflicts.go
- test_helpers.go
- utils.go
- version.go