npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shift-n-run

v1.0.18

Published

Run a command repeatedly, each time with a batch of a fixed number of arguments taken from a given Argument-Pool (like the bash 'shift' command), until the Argument-Pool is empty.

Downloads

13

Readme

shift-n-run

Run a command repeatedly, each time with a batch of a fixed number of arguments taken from a given Argument-Pool (like the bash 'shift' command), until the Argument-Pool is empty.

This is useful in circumstances such as, when wishes to use a utility with lint-staged, however, the utility only accepts one file in its arguments at a time, but lint-staged runs tasks with a list of files as arguments. In this case, use shift-n-run -c your-utility ^1 -a in lint-staged configuration to run the utility repeatedly (in fact concurrently).

Usage

To use, provide a command and the command's arguments with -c option, provide the arguments in the Argument-Pool with the -a option. Use place-holders such as ^1, ^2 etc. in the command's arguments to indicate the arguments to be taken from the Argument-Pool. Use prefix ^ for the command's arguments that starts with '-' or '--' to distinguish with shift-n-run's own options.

For example, shift-n-run -c echo ^1 = ^2 -a one 1 two 2 three 3 -v -n 2 runs the command and its arguments echo ^1 = ^2 repeatedly, each time takes two arguments (specified by the -n option) from the Argument-Pool (provided by the -a option) to replace the place-holders (^1 and ^2), until the Argument-Pool is empty. The option -v shows the executed commands and the outputs.

The result of the example command is:

All executions SUCCEED.
OUTPUTS from command: echo one = 1

one = 1
OUTPUTS from command: echo two = 2

two = 2
OUTPUTS from command: echo three = 3

three = 3

When wishes to use the echo command's -e option, add a prefix ^ to distinguish it from shift-n-run's own options: shift-n-run -c echo ^-e ^1 = ^2 \\n -a one 1 two 2 three 3 -v -n 2

For more details, run with --help

Usage: shift-n-run [options]

Run the command repeatedly, each time with a fixed number of arguments taken from the pooled arguments (like the bash 'shift' command)

Options:
  -c, --command <command-args...>        (required) the command and the arguments to run each time, use place-holders such as ^1, ^2... to
                                         indicate arguments taken from the pooled arguments
  -a, --arguments <pooled-arguments...>  (required) the arguments to be taken a fixed number (option -n) at a time for the execution of the
                                         command
  -n <number-of-arguments>               (optional) number of arguments to be taken at a time (default: "1")
  --prefix <prefix>                      (optional) the prefix for the place-holders (default: "^")
  --concurrency <number-of-concurrency>  (optional) number of maximum concurrency, '0' indicates unlimited concurrency (default: "0")
  -v, --verbose                          (optional) show commands outputs even when succeed (default: false)
  -h, --help                             display help for command

Install

npm install -g shift-n-run

Or install locally