Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Registry = map[string]CommandMapping{}
Registry is kept for backward compatibility (legacy API)
Functions ¶
func RewriteCommand ¶
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 ¶
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 ¶
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)
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 )