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

anti-matter

v0.0.1

Published

flexible command line documentation

Downloads

43

Readme

Antimatter

Flexible command line documentation generation

Why should you care?

You are writing a command line tool in node, and it needs help and usage commands. At the moment, the only simple option is to use the built-in doc generation abilities of a popular arg parser like optimist or commander, but if you don't exclusively use flags for your command line tool, or you have more complex and/or nested command sets, this can end up being messy or impossible.

Antimatter attempts to solve this problem as a tool specifically for documenting command line interfaces in as simple and east-to-read a manner as possible, regardless of how the interface works or how complicated it is.

Installation

npm install antimatter

Usage

Antimatter makes no assumptions about how you have set up your command line interface, it just provides functions that make generating the documentation easier. Let's take a look at a high level example before we dive into it.

var antimatter = require('antimatter');

antimatter({
  title: 'roots cli',
  options: { log: true },
  commands: [{
    name: 'watch',
    required: 'folder',
    optional: ['--no-open', '--no-livereload']
    description: 'watches your project for changes and reloads when detected'
  }, {
    name: 'compile',
    optional: 'path',
    description: 'compiles your project once to the provided <path> or the current directory'
  }]
});

At the moment, antimatter only has one root function - it takes an optional title/header for the doc block, an optional object of options, and either an object or array of objects that represent documented commands. By default it will output a colored and formatted string, ready to print to the command line -- if you pass { log: true } into the options as above, it will console.log it for you. Here's a screenshot of what the above would look like in your terminal.

antimatter docs

API Docs

The antimatter function takes an object with three potential properties, title (optional), options (optional), and commands.

Title

String, serves as the header on the set of documented commands. Optional.

Options
  • log (boolean): console.log the output
  • width (integer): constrain all text to this number of columns
  • color (string): main color for the docs. default is red, available values here
Commands

Either an object or array of objects that detail the command or commands you are documenting. Each object can have a few keys:

  • name (string): name of the command you are documenting
  • required (string/array): optional, required params passed to the command
  • optional (string/array): optional, optional commands passed to the command
  • description (string): description of the command. wrap any param in angle brackets to highlight it.

License & Contributing