UNPKG

2.46 kBMarkdownView Raw
1# comfort [![NPM version](https://badge.fury.io/js/comfort.png)](http://badge.fury.io/js/comfort) [![Build Status](https://travis-ci.org/kaelzhang/node-comfort.png?branch=master)](https://travis-ci.org/kaelzhang/node-comfort) [![Dependency Status](https://gemnasium.com/kaelzhang/node-comfort.png)](https://gemnasium.com/kaelzhang/node-comfort)
2
3Comfort is a much better node.js commander solution for sub commands.
4
5If you have sub commands, such as `<my-module> <command>`, comfort will be extremely helpful.
6
7Comfort is designed to **make your code better organized and of scalability**, unlike [commander.js](https://github.com/visionmedia/commander.js).
8
9If you want to create a complicated command tool with heavy arguments overloading, `comfort` will be your very choice.
10
11## Features
12
13#### Plugin support
14
15A command-line application (`cortex` for example) and its sub-commands built with `comfort` are structured much like git(1).
16
17To develop a new sub-command(`'blah'` for example) as a plugin(so you don't want to change the origin repository of `cortex`), just create a new node.js module, add a value to `bin` field of the package.json as:
18
19```
20{
21 "bin": {
22 "cortex-blah": "bin/xxxxx.js"
23 }
24}
25```
26Comfort will look for `PATH` in your env, and search for a plugin command.
27
28#### Falling love with creating sub-commands
29
30To add a new built-in command(`'haha'` for example), just add a file "haha.js" to the `options.command_root` directory, DONE!
31
32#### Powerful argument parser
33
34
35# Installation
36
37```bash
38npm install comfort --save
39```
40
41# Getting Started
42
43For most situations, you could use `init` command of comfort, and skip all my verbose explanations:
44
45```bash
46npm install comfort -g # install comfort cli
47cd path/to/your/repo
48npm init # run `npm init` first
49comfort init
50npm link # maybe you should use "sudo"
51# Done! and you could see your command immediatly
52<your-bin>
53```
54
55By default, there will be a built-in `'help'` command to display help informations and a `'sample'` command for instance.
56
57You could run
58
59```bash
60<your-bin> sample # to see the result
61<your-bin> help sample # to the help info for `sample`
62```
63
64**All things would be done after a few questions were asked~~**.
65
66****
67
68If you want to figure out how comfort works, well,
69
70> Shut up, just show me the code!
71
72and just see the annotations in the files under `root` directory.
73
74Or, you could execute `comfort init` command, and see what happened to your new project.
75