Skip to content
forked from dthree/vorpal

Node's framework for interactive CLI apps.

License

Notifications You must be signed in to change notification settings

mcanthony/vorpal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vorpal

Build Status

Gitter NPM Version [![Wat: Documented](https://img.shields.io/badge/wat-documented-blue.svg)](https://github.com/dthree/wat) [![XO: Linted](https://img.shields.io/badge/xo-linted-blue.svg)](https://github.com/sindresorhus/xo)

Conquer the command-line.

              (O)
              <M
   o          <M  
  /| ......  /:M\------------------------------------------------,,,,,,
(O)[ vorpal ]::@+}==========================================------------>
  \| ^^^^^^  \:W/------------------------------------------------''''''
   o          <W  
              <W
              (O)

Vorpal is Node's first framework for building interactive CLI applications. With a simple and powerful API, Vorpal opens the door to a new breed of rich, immersive CLI environments like wat and vantage.

Contents

Introduction

Inspired by and based on commander.js, Vorpal is a framework for building immersive CLI applications built on an interactive prompt provided by inquirer.js. Vorpal launches Node into an isolated CLI environment and provides a suite of API commands and functionality including:

  • Simple, powerful command creation
  • Supports optional, required and variadic arguments and options
  • Piped commands
  • Command history
  • Built-in help
  • Built-in tabbed auto-completion
  • Command-specific auto-completion
  • Customizable prompts
  • Extensive terminal control
  • Custom event listeners
  • And more!

Vorpal supports community extensions, which empower it to do awesome things such as piping commands to less, importing commands on the fly or even supporting a built-in REPL.

Made with ❤️ by dthree.

Getting Started

Quick Start

Install vorpal into your project:

$ npm install vorpal --save

Create a .js file and add the following:

var vorpal = require('vorpal')();

vorpal
  .command('foo', 'Outputs "bar"')
  .action(function(args, callback) {
    this.log('bar');
    callback();
  });

vorpal
  .delimiter('myapp$')
  .show();

This creates an instance of Vorpal, adds a command which logs "bar", sets the prompt delimiter to say "myapp$", and shows the prompt.

Run your project file. You Node app has become a CLI:

$ node server.js
myapp~$

Try out your "foo" command.

myapp~$ foo
bar
myapp~$

Now type "help" to see Vorpal's built in commands in addition to "foo":

myapp~$ help

  Commands

    help [command]    Provides help for a given command.
    exit [options]    Exits the app.
    foo               Outputs "bar".

myapp~$

That's the basic idea. Once you get the hang of it, read on to learn some of the fancier things Vorpal can do.

Community

Extensions

You can build your own Vorpal commands and extensions!

Why Vorpal?

One, two! One, two! and through and through
The vorpal blade went snicker-snack!
He left it dead, and with its head
He went galumphing back.

Lewis Carroll, Jabberwocky
Life Goals:
  • Build a popular framework based on the Jabberwocky poem.

Roadmap

  • Suggest something!

License

MIT

About

Node's framework for interactive CLI apps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%