Documentation
¶
Overview ¶
Package builtins implements the DOS built-in command registry.
Index ¶
Constants ¶
const EchoStateKey = "_ECHO"
EchoStateKey is the env key used to persist ECHO ON/OFF state.
Variables ¶
This section is empty.
Functions ¶
func DriveSwitch ¶
DriveSwitch changes the active drive. Called by the exec layer when the command token matches the pattern ^[A-Z]:$.
func RegisterAll ¶
RegisterAll registers every built-in command with r. ver is the version string printed by VER.
Types ¶
type BuiltinFunc ¶
type BuiltinFunc func( args []string, e *env.Env, dm *fsmap.DriveMap, in io.Reader, stdout, stderr io.Writer, ) (int, error)
BuiltinFunc is the signature for a built-in command handler.
- in: stdin (may be nil for commands that don't read it)
- stdout: normal output
- stderr: error/diagnostic output
Returns an ERRORLEVEL value (0 = success).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps command names (uppercase) to their handlers.
func (*Registry) Lookup ¶
func (r *Registry) Lookup(name string) (BuiltinFunc, bool)
Lookup returns the handler for name, if any.
func (*Registry) Register ¶
func (r *Registry) Register(name, desc, usage string, fn BuiltinFunc)
Register adds a builtin under the given name (stored uppercase). desc is a one-line description; usage is a short synopsis (may be "").