pub fn editor_argv() -> Result<Argv>Expand description
Get the editor command from $VISUAL or $EDITOR, parsed into program and args.
Precedence (Unix convention):
$VISUAL(if set and non-empty)$EDITOR(if set and non-empty)- Falls back to
vi
Supports editors with arguments like code --wait or nvim -u NONE.
§Errors
Returns an error if the environment variable value cannot be parsed as shell words (e.g., unbalanced quotes).
§Example
use agentic_tools_utils::cli::editor_argv;
// With no VISUAL/EDITOR set, returns "vi"
std::env::remove_var("VISUAL");
std::env::remove_var("EDITOR");
let argv = editor_argv().unwrap();
assert_eq!(argv.program, "vi");
assert!(argv.args.is_empty());