Function register_command

Source
pub fn register_command<C: Command>(name: &str, desc: &str, command: C)
Expand description

The function call required for generic commands; commands added in this way will be in the Plugins submenu of the menu bar.

ยงExample

struct MyCommand;

impl Command for MyCommand {
    fn action(&self, view: &BinaryView) {
        // Your code here
    }

    fn valid(&self, view: &BinaryView) -> bool {
        // Your code here
        true
    }
}

#[no_mangle]
pub extern "C" fn CorePluginInit() -> bool {
    register_command(
        "My Plugin Command",
        "A description of my command",
        MyCommand {},
    );
    true
}