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

boring

v1.1.1

Published

A minimalist command line option parser.

Downloads

4,970

Readme

Boring

A command line argument parser without pirates

What you get with Boring

Input:

node app jump sideways --foo --bar=whee --super-cool=totally

Response:

{
  _: [ "jump", "sideways"],
  foo: true,
  bar: "whee",
  "super-cool": "totally"
}

Notice that parameters without --, if any, go into the _ array. Parameters with -- become properties in their own right.

How you get it

const argv = require('boring')({});

The options object is optional.

Options

Passthrough

It is a common convention to never treat any arguments that appear after a -- placeholder (by itself) as named options, even if they start with --.

Instead, the remainder are treated as positional arguments, no matter what.

To get this behavior with Boring, pass the end: true option:

const argv = require('boring')({
  end: true
});
console.log(argv);

Now, when you run this command:

node app hello --pretty -- --boring

You will get:

{
  _: [ 'hello', '--boring' ],
  pretty: true
}

What you don't get with boring

Single hyphens: nope

There is no support for old-fashioned "single-hyphen" options, like:

-x 50

Or:

-h

You can't tell which are boolean and which take arguments unless a specification is passed in. And that's not boring enough for us.

Usage messages, strictness, etc.: nope

These are very simple to implement, and if you're like us, you'd rather do it yourself.

Philosophy

We have nothing against full-featured, pirate-themed option parsers, which are very nice if you're into that sort of thing. We just find ourselves walking the plank when our options don't follow the pattern of what's easy to validate with piracy.

This simple module is too dumb to break.

About ApostropheCMS

Boring was created for use in ApostropheCMS, an open-source content management system built on node.js. If you like Boring you should definitely check out apostrophecms.org.

Support

Feel free to open issues on github.