cli

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package cli implements the command-line interface for miru.

The cli package provides: - Command-line argument parsing and validation - Terminal output formatting - Man-like interface implementation - Interactive search functionality - Browser integration through environment configuration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPager

func NewPager(content string, reloadFunc func() (string, api.DocSource, error), docSource api.DocSource) *pagerModel

NewPager creates a new pager model with the given content

func Run

func Run() error

Run executes the main CLI functionality

func RunPager

func RunPager(content string, docSource api.DocSource) error

RunPager starts the pager program with the given content

func RunPagerWithReload

func RunPagerWithReload(content string, reloadFunc func() (string, api.DocSource, error), docSource api.DocSource) error

RunPagerWithReload starts the pager program with the given content and reload function

Types

type DocInfo added in v0.0.6

type DocInfo struct {
	Type           api.SourceType      `json:"type"`
	PackagePath    string              `json:"package_path"`
	URL            string              `json:"url"`
	Homepage       string              `json:"homepage,omitempty"`
	Repository     string              `json:"repository,omitempty"`
	Registry       string              `json:"registry,omitempty"`
	Document       string              `json:"document,omitempty"`
	RelatedSources []api.RelatedSource `json:"related_sources"`
}

DocInfo represents the JSON output structure

type ErrorCode

type ErrorCode string

ErrorCode defines error types for CLI operations

const (
	NoPackageSpecified  ErrorCode = "NoPackageSpecified"
	InvalidLanguageFlag ErrorCode = "InvalidLanguageFlag"
	InvalidLanguage     ErrorCode = "InvalidLanguage"
	InvalidArguments    ErrorCode = "InvalidArguments"
	UnsupportedLanguage ErrorCode = "UnsupportedLanguage"
	UnsupportedSource   ErrorCode = "UnsupportedSource"
)

func (ErrorCode) ErrorCode

func (c ErrorCode) ErrorCode() string

Jump to

Keyboard shortcuts

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