pour-console
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

pour-console

npm version

A simplified promise-based spawn, with real-time logging to console.

Usage

const { pour } = require('pour-console');

(async () => {
  await pour('git switch "non-existent branch"')
  await pour('echo "does not reach here"')  // Will not reach here.
})().catch(console.error)

Deviation from spawn

This project uses shlex to simplify command calling; however you can directly use it without shlex by

await pour([
  'git',
  'commit',
  '-m',
  'long Long commit message'
])

As this also inherits spawn, you can specify cwd by

await pour('git add .', {
  cwd: './dist'
})

Special apps and apps that need Ctrl key

In this case, you'll need to use the good ol' stdio: "inherit".

await pour('nano file.txt', {
  stdio: 'inherit'
})

Installation

yarn add pour-console  # or npm i pour-console

About the name

The name comes from a different package -- std-pour, with quite a similar functionality. But this package is enhanced.

Readme

Keywords

none

Package Sidebar

Install

npm i pour-console

Weekly Downloads

1

Version

1.1.2

License

MIT

Unpacked Size

6.3 kB

Total Files

9

Last publish

Collaborators

  • patarapolw