Skip to content

Commit e3a0b02

Browse files
committed
feat(repl-logic): add man as reserved command
1 parent c3948c2 commit e3a0b02

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

crates/pluginlab/tests/e2e_test.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,4 +408,33 @@ mod e2e_test {
408408
.exp_string("ls: : Operation not permitted")
409409
.expect("Didn't get expected error output");
410410
}
411+
412+
#[test]
413+
fn test_man_command() {
414+
let project_root = find_project_root();
415+
println!("Setting current directory to: {:?}", project_root);
416+
std::env::set_current_dir(&project_root).unwrap();
417+
let mut session = spawn(
418+
&build_command(&["plugin_greet.wasm"], "repl_logic_guest.wasm"),
419+
Some(TEST_TIMEOUT),
420+
)
421+
.expect("Can't launch pluginlab with plugin greet");
422+
423+
session
424+
.exp_string("[Host] Starting REPL host...")
425+
.expect("Didn't see startup message");
426+
session
427+
.exp_string("[Host] Loading plugin:")
428+
.expect("Didn't see plugin loading message");
429+
session.send_line("man").expect("Failed to send command");
430+
session
431+
.exp_string(" man - Show the manual for a command")
432+
.expect("Didn't see man command name");
433+
session
434+
.send_line("man man")
435+
.expect("Failed to send command");
436+
session
437+
.exp_string(" man - Show the manual for a command")
438+
.expect("Didn't see man command name");
439+
}
411440
}

crates/repl-logic-guest/src/reserved.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,26 @@ DESCRIPTION
7171
},
7272
run: None,
7373
},
74+
ReservedCommand {
75+
name: "man",
76+
man: || transport::PluginResponse {
77+
status: transport::ReplStatus::Success,
78+
stdout: Some(format!(
79+
r#"
80+
NAME
81+
man - Show the manual for a command
82+
83+
SYNOPSIS
84+
man <command>
85+
86+
DESCRIPTION
87+
Show the manual for a command.
88+
"#,
89+
)),
90+
stderr: None,
91+
},
92+
run: None,
93+
},
7494
ReservedCommand {
7595
name: "list-commands",
7696
man: || transport::PluginResponse {

0 commit comments

Comments
 (0)