Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Built in commands #107

Open
jseparovic opened this issue Jun 15, 2022 · 3 comments
Open

Disable Built in commands #107

jseparovic opened this issue Jun 15, 2022 · 3 comments

Comments

@jseparovic
Copy link

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.

@jseparovic
Copy link
Author

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
#108

@jseparovic
Copy link
Author

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

@sahinme
Copy link

sahinme commented Apr 1, 2024

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");
          });
        },
      }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants