Skip to main contentModule handlers
Source - HandlerContext
- Context passed to handlers for classification.
- SubcommandHandler
- A data-driven handler for commands with simple subcommand-based classification.
- Classification
- The result of classifying a command.
- SAFE_DIRECTORIES
- Default directories that are always considered safe for path-based handlers.
- Handler
- Trait for command handlers.
- all_handler_commands
- Return all handler-registered command names, sorted alphabetically.
- first_positional
- Helper: get the first positional argument (non-flag).
- get_flag_value
- Helper: get the value following a flag (e.g.,
-o output.txt → Some("output.txt")). - get_handler
- Look up a handler by command name.
- handler_count
- Return the number of registered handler command names.
- has_flag
- Helper: check if any arg matches a set of flags.
- is_within_scope
- Check if a resolved, normalized path is within the working directory,
a config-allowed directory, or a default safe directory.
- normalize_path
- Logical path normalization: resolve
. and .. components without
filesystem access (the target directory may not exist yet). - positional_args
- Helper: collect all positional (non-flag) arguments.