Wizcorp/climaker

Name: climaker

Owner: Wizcorp

Description: [WIP] Tool to create CLI interfaces in Node.js

Created: 2015-12-12 17:21:56.0

Updated: 2016-03-17 11:14:34.0

Pushed: 2016-01-06 03:16:02.0

Homepage: null

Size: 25

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

climaker

This library is used for creating nice, clean and consistent CLI UI tools in Node.js, with great speed.

Features
How to use

The following commands will help you get set up:

install -g climaker

eate a project with a single binary
aker create myCommand

d commands to the binary
aker command create newCommand
aker command create new subCommand

d a second binary
aker binary create mySecondCommand

d commands to the second binary
aker command create -b mySecondCommand create newCommand
aker command create -b mySecondCommand create new subCommand
Manually creating commands

Under the bin/ folder of your package, add a script with the following content:

sr/bin/env node

path = require('path');
packageInfo = require('../package.json');

maker = require('../../climaker');
commandName = 'mytool'

r(commandName, packageInfo.version, path.join(__dirname, '../commands'));

Then:

d +755 bin/mytool
r ./commands

And, finally, under ./commands/index.js:

rts.describe = {
en: 'My sweet command line',
fr: 'Ma commande de ligne sucrée (tee hee)'

And start coding! Add your commands in the ./commands folder:

/commands/create.js
rts.describe = {
en: 'Create a new organization.',
ja: '???????????'


rts.unnamedParams = {
name: 'something',
describe: 'I no bother with localize',
allow: true, // or int for how many to allow, or false if you want to be strict
demand: true // required, set up a count, or false to make optional


rts.params = [{
name: 'name',
demand: true,
describe: {
    en: 'Name',
    ja: '????'
}


ee https://www.npmjs.com/package/yargs#option-key-opt
rts.options = {
d: {
    alias: 'dest',
    demand: true
},
f: {
    alias: 'force',
    describe: 'Force create',
    boolean: true
}


ptions will contain all your options as well as
nnamed parameters
rts.execute = function (options, name, callback) {
console.log('HERE IS YOUR NEW ORG');
callback();

You can create sub-folders as well: they will become nested commands. However, you must make sure to put an index.js script with the description of this nested command's subcommand.

For instance, to create the command:

ol module create myModule --lang=csharp

You would need to create the folder ./commands/module, add a description for the module subcommand in ./commands/module/index.js, and the nested command itself in ./commands/module/create.js.

Todo
License

MIT.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.