Git Product home page Git Product logo

with-this's Introduction

with-this Build Status

With is a CLI to execute any shell command with multiple variables concurrently. xargs is a similar utility. Place the this keyword anywhere in your command and with will iterate through all the input values, replace this with a value and execute the resulting command.

If you have multiple this in your command, each one will be replaced (todo: this should be controllable in a future release using flags).

If you don't place this in your target command, then with will iterate the same command n times where n equals the number of items in your --values input.

In case of errors, with will only report and continue with the remaining iterations/values.

Installation

macOS

$ brew install amritb/tap/with-this

Linux / Windows

You can build it from source using go build and put it in your $PATH.

$ go build main.go -o with

Usage

with --values "$(INPUT)" "COMMAND"

Flags:
  -h, --help            help for with
  -v, --values string   Iterate with these values
      --version         version for with

Examples

You have a list of URLs in a text file and want to curl all of them in parallel, with one command:

$ with -v "$(cat myurls.txt)" "curl -L this"

You want to quickly check AWS instance status for all the regions:

$ with -v "$(cat myregions.txt)" "aws --region=this ec2 describe-instance-status"

You have a directory with lots of kubeconfig files and want to get pods from all the different clusters using kubectl command:

$ with -v "$(ls | grep config)" "kubectl --kubeconfig=this get pods"

Run the exact same command 10 times in parallel:

$ with -v "$(echo {1..10})" "echo 123"

with-this's People

Contributors

amritb avatar

Watchers

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