discover

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Registry = map[string]CommandMapping{}

Registry is kept for backward compatibility (legacy API)

Functions

func Rewrite

func Rewrite(command string) string

Rewrite is the legacy API for backward compatibility

func RewriteCommand

func RewriteCommand(cmd string, excluded []string) (string, bool)

RewriteCommand rewrites a command to its TokMan equivalent. Returns the rewritten command and true if rewritten, or original and false if not. Handles compound commands (&&, ||, ;, |) by rewriting each segment.

func ShouldRewrite

func ShouldRewrite(command string) bool

ShouldRewrite returns true if a command should be rewritten

Types

type Classification

type Classification struct {
	Supported   bool
	TokManCmd   string
	Category    string
	SavingsPct  float64
	Status      TokmanStatus
	BaseCommand string // For unsupported commands
}

Classification represents the result of classifying a command

func ClassifyCommand

func ClassifyCommand(cmd string) Classification

ClassifyCommand classifies a single command

type CommandMapping

type CommandMapping struct {
	Original  string
	TokManCmd string
	Enabled   bool
	PassArgs  bool
}

CommandMapping defines how a command should be rewritten (legacy API)

func GetMapping

func GetMapping(command string) (CommandMapping, bool)

GetMapping returns the mapping for a command if one exists (legacy API)

func ListRewrites

func ListRewrites() []CommandMapping

ListRewrites returns all enabled rewrites

type TokmanRule

type TokmanRule struct {
	TokManCmd       string
	RewritePrefixes []string
	Category        string
	SavingsPct      float64
	SubcmdSavings   map[string]float64
	SubcmdStatus    map[string]TokmanStatus
}

TokmanRule defines how a command pattern should be rewritten

type TokmanStatus

type TokmanStatus int

TokmanStatus represents the status of a command rewrite

const (
	StatusExisting TokmanStatus = iota
	StatusPassthrough
	StatusNew
)

Jump to

Keyboard shortcuts

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