Add stdin support to any CLI app that accepts file input
JavaScript
Switch branches/tags
Clone or download
Latest commit c293a10 Mar 25, 2018
Permalink
Failed to load latest commit information.
.editorconfig Require Node.js 6 Mar 25, 2018
.gitattributes Require Node.js 6 Mar 25, 2018
.gitignore Require Node.js 6 Mar 25, 2018
.npmrc Require Node.js 6 Mar 25, 2018
.travis.yml Require Node.js 6 Mar 25, 2018
cli.js Require Node.js 6 Mar 25, 2018
fixture.js Require Node.js 6 Mar 25, 2018
license Require Node.js 6 Mar 25, 2018
package.json 2.0.0 Mar 25, 2018
readme.md Require Node.js 6 Mar 25, 2018
test.js Require Node.js 6 Mar 25, 2018

readme.md

tmpin Build Status

Add stdin support to any CLI app that accepts file input

It pipes stdin to a temp file and spawns the chosen app with the temp file path as the first argument.

Similar to process substitution in ZSH/Bash, but cross-platform and without its limitation.

Install

$ npm install --global tmpin

Usage

$ tmpin --help

  Usage
    echo <string> | tmpin <app> [<args>]

  Example
    git diff | tmpin atom

  Note that the first argument to <app> will be set to the temp file

Tip

Create an alias in your .zshrc/.bashrc:

alias atom='tmpin atom'

# Or more specific
alias gda='git diff | tmpin atom'

License

MIT © Sindre Sorhus