Skip to content

lirantal/opn-shell

Repository files navigation

opn-shell

Execute shell commands and detect cross-platform terminal emulators

npm version license downloads build codecov Known Vulnerabilities Security Responsible Disclosure

About

opn-shell allows you to execute shell commands in a terminal emulator window that opens either as a tab or a new window (depending on your terminal emulator) configuration.

It will automatically detect the available terminal emulators that exist in your OS and supports both MacOS and Linux, with a fallback to the associated program on Windows.

Install

npm install --save opn-shell

Usage

Call opn-shell() with a full path to an executable that will be launched in a terminal window.

If the promise returned by opn-shell() rejects then it failed to detect and open a terminal window.

// @TODO
const TerminalLauncher = require('opn-shell')

const executable = '/usr/local/bin/my-shell-program.sh'
TerminalLauncher.launchTerminal({ path: executable }).catch(err => {
  console.log(err)
})

CLI

npx opn-shell my-shell-program.sh

Contributing

Please consult CONTIRBUTING for guidelines on contributing to this project.

Author

opn-shell © Liran Tal, Released under the Apache-2.0 License.