Coder Social home page Coder Social logo

cypress's Introduction

cypress

Turn (almost) any streaming output into a progress bar.

Basic Usage

Cypress supports progress by number of lines:

ping ::1 -c 10 | cypress --lines --max 10

Alternatively, you can transform the output into a stream of integers and provide the --min and --max options:

ping ::1 -c 10 | sed 's/.*seq=\([0-9]\+\).*/\1/' | cypress --min 1 --max 10

Note that in this example the piped data contains a non-integer (empty string) line. This is ignored by Cypress, as would values outside the --min and --max range.

Also, cypress supports regex parsing out of the box:

ping ::1 -c 10 | cypress --min 1 --max 10 --regex 'seq=(\d+)'

If you are having trouble getting the correct regex working (we've all been there), try adding the debug option for additional info on what happens during parsing:

ping ::1 -c 10 | cypress --min 1 --max 10 --regex 'seq=(\d+)' --debug

Further Examples

Popular intermediate formats can easily be adapted by using an existing processor for the repsective format. Some popular examples include:

JSON

Here we will use the jq command line JSON processor:

./test_json.sh | jq '.id' --unbuffered | cypress --min 1 --max 10

CSV

Here we will use the qsv command line CSV processor, a fork of the more popular xsv:

export QSV_RDR_BUFFER_CAPACITY=1
export QSV_WTR_BUFFER_CAPACITY=1
./test_csv.sh | qsv select id | cypress --min 1 --max 10

Setting the QSV_RDR_BUFFER_CAPACITY and QSV_WTR_BUFFER_CAPACITY to 1 byte each will make qsv stream line by line without unwanted buffering.

cypress's People

Contributors

qkniep avatar

Watchers

 avatar

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.