1.0.0 • Published 5 years ago

tualo-commander v1.0.0

Weekly downloads
65
License
-
Repository
github
Last release
5 years ago

tualo-commander

Build Status endorse

tualo-commander is a generic git style command line library.

Usage

The snippets below show how it works:

Create a file mycommand in ./bin

#!/usr/bin/env node
Cli = require('../lib/main').Cli;
cli = new Cli();
cli.commands(__dirname+'/commands');
cli.extension('.js');
cli.main();

Create a file mycommand-sample in ./bin

#!/usr/bin/env node
path = require('path');
Cli = require('../lib/main').Cli;
cli = new Cli();
cli.commands(path.join(__dirname,'..','lib','commands'));
cli.extension('.js');
cli.main('sample');

Create a file sample.js in ./lib/commands

Command = require('../../lib/main').Command;

// sample command
Sample = function(){

}

Sample.commandName = 'sample';
Sample.commandArgs = ['my','command','list'];
Sample.options = [
  {
    parameter: "-d,--debug",
    description: "enable debug mode"
  }
];

Sample.commandShortDescription = 'my command description';

Sample.help = function() {
  return "put your help text here";
};

Sample.prototype.action = function(opts, args){
  // do your command stuff here
}


module.exports = Sample;

Now you can use:

mycommand help
mycommand help sample
mycommand sample
1.0.0

5 years ago

0.0.9

6 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

8 years ago

0.0.5

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago