terminal-in-react icon indicating copy to clipboard operation
terminal-in-react copied to clipboard

How to send a message to the terminal?

Open vBoykoGit opened this issue 6 years ago • 1 comments

Hi, I want to send messages to terminal from code like console.log('message') but without showing it in application console

vBoykoGit avatar Mar 05 '19 09:03 vBoykoGit

this might help:

  const printInTerminal = (content) => {
    terminalRef.current.state.instances[0].instance.updater.enqueueSetState(
      terminalRef.current.state.instances[0].instance,
      {
        summary: [
          ...terminalRef.current.state.instances[0].instance.state.summary,
          ...(Array.isArray(content) ? content.map((c) => [c]) : [content]),
        ],
      }
    );
  };

To print one line just do printInTerminal('Hello world!') To print multiple lines do printInTerminal(['Hello world!', 'Foo bar'])

luisgrases avatar Oct 16 '21 19:10 luisgrases