Skip to main content

register_native_command

Function register_native_command 

Source
pub fn register_native_command<F>(name: &str, f: F)
where F: Fn(&[String]) -> i32 + Send + Sync + 'static,
Expand description

Register a native command contributed by the linking binary.

Convenience re-spelling of native_cmds::register at the crate root, so a fat binary’s main reads as one call per runtime:

ⓘ
zsh::register_native_command("git", |argv| zvcs::run_argv(argv));

The name then dispatches in-process — whence -w git says builtin, ${+builtins[git]} is 1, builtin git reaches it, a user git() function still shadows it, and command git still runs the one on PATH.