terminal-in-react
terminal-in-react copied to clipboard
Disable Built in commands
Any chance of adding the ability to disable builtin commands? I'd like to use this component as a passthrough to a cisco router, but I can't run any show commands because it's a built-in command.
I created this PR, although I couldn't figure out how to stop the "show" command being called on load. But this PR allows me to run passthrough "show" commands now. Cheers https://github.com/nitin42/terminal-in-react/pull/108
I tried using plugin take control, but then I lost history and ability to change the prompt. Being able to disable the builtin commands and using plugins for output and prompt control worked for my use case. Cheers. Thanks heaps for this library. Really cool
You don't need extra plugin or anything, just override commands props for built-in commands
commands={{
show: (args, print, runCommand, ...rest) => {
print("waiting for response...");
sendCommand("show", Mac).then((res) => {
!!res ? print(<pre>{res}</pre>) : print("No response");
});
},
help: (args, print, runCommand, ...rest) => {
print("waiting for response...");
sendCommand("help", Mac).then((res) => {
!!res ? print(<pre>{res}</pre>) : print("No response");
});
},
}}