app-term-kit

Utility for creating command line applications

Usage no npm install needed!

<script type="module">
  import appTermKit from 'https://cdn.skypack.dev/app-term-kit';
</script>

README

app-term-kit

This gives you a few features for your app:

  • action centric structure (<app-name> <action> <other stuff>)
  • automatic handling of commented JSON config files and setting values therein
  • automatic handling of optional ~/.<app-name> directories (and easy init)
  • automatic handling of classes of plugins installed in ~/.<app-name>
    • simple require shim for plugin loading
    • automated installation and (eventually) maintenance
  • handle ansi configuration of yargs and adding some features/simplifications
    • handle flag collisions
    • (eventually) formatting widths to terminal width
    • (eventually) handle other libraries
  • rights notifications & licensing information
  • (eventually) man pages
  • test harness (use common tests/data between CLI and Classes)

Installation

npm install app-term-kit

Usage

var app = new CLApp('app-name', {
    copyright : 'Ed Beggler',
    copystart : '2020',
    defaults : `{
  // This file was autogenerated by app-name
  //
  "name": "robble-rauser",
  "type": "*",
  "debug": false
}`
});

.command()

Define a command, with it's runtime logic

app.command({});

.argument()

Define a flag or argument to be passed to one or more commands

app.argument({});

.help()

Enable help function via --help or -h

app.help();

.header()

The prefix to all the documentation

app.header({});

.footer()

The suffix to all the documentation

app.footer({});

.plugins(, )

Enable and load sets of plugins

app.plugins({}, cb);

.useable(, )

allow the user to interactively alter the config file

app.useable(cb);

.config()

Get the app's current configuration

app.config(cb);

.run()

Execute based on the existing configuration.

app.run(cb);

Events

using .on(), .off(), .emit() and .once() the user can interact with events that are generated from the object.

- `plugins-installed` : one or more plugins has been installed.

Roadmap

[More to come]