help

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package help implements the help command with search and discovery features.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectTopics

func CollectTopics(root *cobra.Command) []string

CollectTopics returns all unique topics defined in the command tree.

func NewCmdHelp

func NewCmdHelp(root *cobra.Command) *cobra.Command

NewCmdHelp creates the help command with search and discovery features.

func RegisterTopicEnum

func RegisterTopicEnum(cmd *cobra.Command, flagName string)

RegisterTopicEnum registers the standard topics as enum values for --topic flag.

func SetTopicAnnotation

func SetTopicAnnotation(cmd *cobra.Command, topic string)

SetTopicAnnotation adds a topic annotation to a command. Deprecated: Use cmdutil.SetTopicAnnotation instead.

Types

type CommandInfo

type CommandInfo struct {
	Path    string   // Full command path (e.g., "gc pr view")
	Name    string   // Command name (e.g., "view")
	Short   string   // Short description
	Topic   string   // Topic category (from annotation)
	Aliases []string // Command aliases
	Hidden  bool     // Whether command is hidden
}

CommandInfo holds metadata about a command for search and discovery.

func BuildIndex

func BuildIndex(root *cobra.Command) []CommandInfo

BuildIndex traverses the command tree and builds a searchable index.

func FilterByTopic

func FilterByTopic(index []CommandInfo, topic string) []CommandInfo

FilterByTopic returns commands belonging to a specific topic.

func Search(index []CommandInfo, keyword string) []CommandInfo

Search finds commands matching the given keyword. Matches against path, name, short description, and aliases.

type HelpOptions

type HelpOptions struct {
	Root   *cobra.Command
	Search string
	Topics bool
	Topic  string
	JSON   bool
}

Source Files

  • help.go
  • search.go

Jump to

Keyboard shortcuts

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