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

clapp

v1.3.3

Published

A tool for building command line apps that don't aren't necessarily built for the command line.

Downloads

47

Readme

clapp NPM version Build Status Dependency Status Coverage percentage

A tool for building command line apps that aren't necessarily built for the command line.

Average time to resolve an issue Percentage of issues still open PRs Welcome

Installation

$ npm install --save clapp

Features

  • Input isn't restricted to node's process.argv, unlike other libraries, so you may use Clapp for a node cli app, or use it for anything alse. For instance, you may use it for a discord bot, where an user message is the input, and the bot behaves like a command line app.
  • Clapp also handles command execution. When using other command parsing libraries, you'd need to manually execute the command function by evaluating the user input. Clapp will execute the command for you if the user input satisfies your needs, or let the user know the error otherwise.
  • Clapp allows you to have precise control of user input: it takes care of required arguments, default values, data types, and data validation for you.
  • It also handles documentation. Clapp takes an "if you don't document it, go fuck yourself" apporach, meaning that it will simply not work if you don't document your app. For example, if you don't declare an argument that you expect the user to pass, Clapp will ignore it and not pass it back to you. But because of that, Clapp is able to easily print documentation to the user when they pass the --help flag.
  • Clapp handles the --version flag as well.

Usage

const Clapp = require('clapp');

let app = new Clapp.App({
	name: "Test App",
	desc: "An app that does the thing",
	prefix: "-testapp",
	version: "1.0",
	onReply: function(msg, context) {
		// Clapp will use this function to
		// communicate with the end user
		console.log(msg);
	}
});

app.addCommand(new Clapp.Command({
	name: "foo",
	desc: "An example command",
	fn: function(argv, context) {
		return "Foo was executed!"
	}
}));

let userInput = "-testapp foo";

// Checks if the user input is an acceptable command
if (app.isCliSentence(userInput)) {
	app.parseInput(userInput); // logs "Foo was executed!"
}

Please check out the docs for the full instructions!

License

Apache-2.0 © Pablo Rodríguez