Numeric Production Mechanism

    @ueqt/cli
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.4 • Public • Published

    Ucli

    NPM Version Build Status NPM Downloads Package Quality Build Status codecov

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

    Contents

    Introduction

    Inspired by and based on vorpal and vorplajs-reforged, Ucli is a framework for building immersive CLI applications built on an interactive prompt provided by inquirer.js. Ucli 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
    • Persistent command history
    • Built-in help
    • Built-in tabbed auto-completion
    • Command-specific auto-completion
    • Customizable prompts
    • Extensive terminal control
    • Custom event listeners
    • And more

    Ucli supports community extensions, which empower it to do awesome things such as piping commands to less, importing commands live or supporting a built-in REPL.

    Made with ❤️ by ueqt.

    Getting Started

    Quick Start

    Install ucli into your project:

    $ npm install @ueqt/ucli --save

    Create a .js file and add the following:

    const Ucli = require('@ueqt/cli').Ucli;
    const ucli = new Ucli();
    const chalk = require('@ueqt/cli').chalk;
     
    ucli.command('foo', 'Outputs "bar".').action(function(args, callback) {
      this.log('bar');
      callback();
    });
     
    ucli.delimiter('myapp$').show();

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

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

    $ node server.js
    myapp~$

    Try out your "foo" command.

    myapp~$ foo
    bar
    myapp~$

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

    myapp~$ help
     
      Commands
     
        help [command]    Provides help for a given command.
        exit [options]    Exits instance of Ucli.
        foo               Outputs "bar".
     
    myapp~$

    There's the basics. Once you get the hang of it, follow this tutorial or read on to learn what else Ucli can do.

    Community

    Questions? Use the ucli.js StackOverflow tag for fast answers that help others, or jump into chat on Gitter.

    API

    Command
    Mode
    Catch
    CommandInstance
    UI
    Vorpal
    Events

    Extensions

    You can build your own Vorpal commands and extensions.

    FAQ

    License

    MIT © Ueqt

    Install

    npm i @ueqt/cli

    DownloadsWeekly Downloads

    7

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    3.27 MB

    Total Files

    26

    Last publish

    Collaborators

    • avatar