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 🙏

© 2025 – Pkg Stats / Ryan Hefner

rargv

v0.0.3

Published

Read command line arguments from input files

Downloads

14

Readme

rargv

Node.js tool to read command line arguments from input files

When using some cli tools to process/transform files, there are some common arguments we have to write again and again, some arguments won't change for certain files, and stuff like that. This is often solved with configuration files (aka rc files), but sometimes we need basic configuration in a per-file basis. The idea of this tool is to include argv parameters inside the files and read them right before executing the target command.

Install

$ npm install -g rargv

Usage

Specifying arguments inside a file

Do it within comments with this format:

/* @argv <tool> <arguments> */

arguments will be appended to the argument list when this file is going to be processed by the specified tool. For example:

/* @argv lessc ./css/compiled.css */

Now we have to proxy our command (in this example, for lessc) with rargv in order to correctly parse and apply the defined parameters.

$ rargv lessc source.less

Rargv will read the file source.less, check if there's something configured for the invoked tool (lessc) and if so, it'll append what's defined in there and run the full command. So, this will equivalent to:

$ lessc source.less css/compiled.css

More complex example

In a javascript file:

/* @argv browserify -o ../../dist/js/app.js -t babelify */

Then, running $ rargv browserify sources/js/myfile.js will translate to:

$ browserify sources/js/myfile.js -o dist/js/app.js -t babelify

Variables

There are some variables exposed to the @argv directive:

  • $filename filename with extension, for example: index.html
  • $basename filename without extension, for example: index
  • $extname file extension, for example: .html
  • $dirname directory name, relative from the cwd, for example: .

Copyright and Licensing

Copyright (c) 2016 Nicolás Arias, released under the MIT license.