1#![allow(non_upper_case_globals)]
2
3use bash_plugin_rs::{argv_list, builtin, word_list, BUILTIN_ENABLED};
4use std::ffi::CStr;
5
6pub fn hello_main(argv: &[&CStr]) -> i32 {
7 if !argv.is_empty() {
8 println!("Hello World! {:#?}", argv);
9 } else {
10 println!("Hello World!");
11 }
12 0
13}
14
15#[no_mangle]
16pub unsafe extern "C" fn hello_func(word_list: *mut word_list) -> i32 {
17 hello_main(&argv_list(&mut *word_list))
18}
19
20#[no_mangle]
21pub static mut hello_struct: builtin = builtin {
22 name: b"hello\0" as *const u8,
23 function: Some(hello_func),
24 flags: BUILTIN_ENABLED as i32,
25 long_doc: &mut [
26 b"Print Hello World.\0" as *const u8,
27 b"\0" as *const u8,
28 b"Blah, Blah\0" as *const u8,
29 b"\0" as *const u8,
30 b"Usage:\0" as *const u8,
31 b"\0" as *const u8,
32 b" $ hello \0" as *const u8,
33 b"\0" as *const u8,
34 0 as *const u8,
35 ] as *mut _ as *const *const u8,
36 short_doc: b"Prints Hello World\0" as *const u8,
37 handle: 0 as *mut u8,
38};