man

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValidManSectionPattern = `^[a-zA-Z0-9]+$`
)

Variables

This section is empty.

Functions

func CreateManPageSchema

func CreateManPageSchema() *jsonschema.Schema

func GetManPage

func GetManPage(ctx context.Context, req *mcp.CallToolRequest, params *GetManPageParams) (*mcp.CallToolResult, any, error)

func IsManAvailable added in v0.3.4

func IsManAvailable() bool

IsManAvailable checks if the man binary is available in PATH. Returns true if man is found, false otherwise.

func SetExecutor added in v0.3.0

func SetExecutor(e Executor)

Types

type DefaultExecutor added in v0.3.0

type DefaultExecutor struct{}

DefaultExecutor uses os/exec to run commands.

func (*DefaultExecutor) Run added in v0.3.0

func (e *DefaultExecutor) Run(ctx context.Context, name string, args ...string) ([]byte, []byte, error)

type Executor added in v0.3.0

type Executor interface {
	Run(ctx context.Context, name string, args ...string) ([]byte, []byte, error)
}

Executor interface for running external commands.

type GetManPageParams

type GetManPageParams struct {
	Name     string   `json:"name" jsonschema:"Name of the man page"`
	Section  string   `json:"section,omitempty" jsonschema:"Section of the man page (default 1, e.g., 1, 8, 8p, 3perl)"`
	Offset   int      `json:"offset,omitempty" jsonschema:"Line offset for pagination"`
	Limit    int      `json:"limit,omitempty" jsonschema:"Maximum number of lines to return (default 500)"`
	Chapters []string `json:"chapters,omitempty" jsonschema:"List of chapters to retrieve (e.g. ['NAME', 'SYNOPSIS'])"`
}

type ManPageResult

type ManPageResult struct {
	Content    string   `json:"content"`
	Chapters   []string `json:"chapters"`
	TotalLines int      `json:"total_lines"`
}

Jump to

Keyboard shortcuts

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