Giter Site home page Giter Site logo

zargs's Introduction

Zargs

a non-complete alternative to xargs with advanced templating and less cli args to bother with. One major difference is that xargs on default passes all lines from stdin to the provided command and a flag turns this off so that line wise processing is done... zargs always does line wise processing...

Examples

Append option

The most common usage, where the line from stdin is just appended to the provided command. NOTE: this is line wise processing and it does not pass all input to the command at once.

❯ docker ps --format '{{ .ID }}' | zargs docker rm -f
...

Using templating

As there are essentially two columns in the input we can use the templating syntax to build our commmand.

❯ ps --no-headers -o pid,exe | zargs echo '{1} using pid {0}'
/usr/bin/bash using pid 7374
/usr/bin/ps using pid 167559
/usr/local/bin/zargs using pid 167560

Usage

❯ zargs --help
    -h, --help
            Display this help and exit.

    -d, --delimiter <str>
            Column delimiter to use for templating (Defaults to: ' ').

    -s, --tplstart <str>
            What character sequence starts a template placeholder (Defaults to: '{').

    -e, --tplend <str>
            What character sequence ends a template placeholder (Defaults to: '}').

    <str>...

Building

zig build

zargs's People

Contributors

sojamann 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.