0.2.1 • Published 12 years ago

cmdl v0.2.1

Weekly downloads
3
License
-
Repository
github
Last release
12 years ago

Build Status

#cmdl 0.1.0#

A simple, yet powerful command-line interface builder.

##Installation##

[![NPM](https://nodei.co/npm/beardcomb.png)](https://nodei.co/npm/cdml/)

##API Reference##

###cmdl.setVersion( version )###

cli.setVersion('0.0.1');

###cmdl.addCommand( properties )###

cli.addCommand({
    name: 'create',
    description: 'create a new blog',
    options: [{
        name: 'name',
        short: 'n',
        type: 'string',
        description: 'blog name',
        example: 'cmdl-test create -n testblog'
    }],
    callback: function(args) {
        console.log("create method was called: ", args);
    }
});

###cmdl.addOption( properties )###

cli.addOption({
    name: 'port',
    short: 'p',
    type: 'int',
    description: 'port',
    example: 'cmdl-test -p 8080',
    callback: function(port) {
        console.log("Port is: ", port);
    }
});

###cmdl.prompt( message, callback )###

cli.prompt('What is you name ?', function(answer, prompt) {
    console.log("Hello, " + answer + "!");
    prompt.pause(); //see readline module for details
});

###cmdl.execute( command, callback )###

cli.execute('ls -alF', function(err, stdout, stderr) {
    if(err) throw err;
    if(stderr) throw stderr;
    console.log("responsse: ", stdout);
});

###cmdl.listen()###

cli.listen(); //enables the CLI

##Test##

npm test

##Demo##

npm install -g cmdl
cmdl-test -h

##TODO##

  • Improve unit tests
  • Implement password prompt
0.2.1

12 years ago

0.2.0

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago