Giter Site home page Giter Site logo

stefanmaric / ntee Goto Github PK

View Code? Open in Web Editor NEW
23.0 4.0 2.0 13 KB

Portable Unix shell command 'tee', with some extras - read from standard input and write to standard output and files

Home Page: https://www.npmjs.com/package/ntee

License: MIT License

JavaScript 100.00%
shell tee npm npm-scripts stdout ntee pipe stdin

ntee's Introduction

ntee

Portable Unix shell command tee, with some extras โ€” read from standard input and write to standard output and files.

TL;DR

gulp.dest() in middle of a pipe? NPM scripts can do as well:

{
  "scripts": {
    "less": "lessc main.less | postcss --use autoprefixer | ntee main.css | cleancss > main.min.css"
  }
}

Install

$ npm install -g ntee

Check

$ ntee --help

Use

Usage:
  ntee [OPTION]... FILE...

  Copy standard input to each FILE, and also to standard output.

Options:
  -a, --append              append to the given FILEs, do not overwrite
  -i, --ignore-interrupts   ignore interrupt signals
  -s, --suppress            do not output to stdout
  -v, --version             display the current version
  -h, --help                display help and usage details
$ whoami | ntee file1.txt file2.txt

Will print current user to stdout and also to file1.txt and file2.txt. Note that if these files already exist, they will be overwritten. Use -a/--append to avoid it, just like you would do with Richard Stallman's tee:

$ whoami | ntee -a i-wont-be-overwritten.txt

-i/--ignore-interrupts will prevent CTRL+C from killing ntee. Won't work on windows.

I also added an -s/--suppress option to suppress output to stdout. This meant to be used on npm scripts:

$ echo "Nothing will be shown in screen" | ntee -s but-it-will-be-saved-here.txt

You can always pipe:

cat long.log | sort | ntee sorted.log | head

License

MIT โ™ฅ

ntee's People

Contributors

aitbw avatar stefanmaric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

aitbw bcoe

ntee's Issues

No colors on stdout

Hi,
Thanks for this tool.

I have a following problem.
When I execute mocha there are colors on stdout.

Although when I execute:

mocha | ntee ./build/test-report.txt

colors are missing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.