Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / cliui / README.md
1 # cliui
2
3 [![Build Status](https://travis-ci.org/bcoe/cliui.png)](https://travis-ci.org/bcoe/cliui)
4 [![Coverage Status](https://coveralls.io/repos/bcoe/cliui/badge.svg?branch=)](https://coveralls.io/r/bcoe/cliui?branch=)
5 [![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui)
6
7 easily create complex multi-column command-line-interfaces.
8
9 ## Example
10
11 ```js
12 var ui = require('cliui')({
13   width: 80
14 })
15
16 ui.div('Usage: $0 [command] [options]')
17
18 ui.div({
19   text: 'Options:',
20   padding: [2, 0, 2, 0]
21 })
22
23 ui.div(
24   {
25     text: "-f, --file",
26     width: 40,
27     padding: [0, 4, 0, 4]
28   },
29   {
30     text: "the file to load",
31     width: 25
32   },
33   {
34     text: "[required]",
35     align: 'right'
36   }
37 )
38
39 console.log(ui.toString())
40 ```
41
42 ## Layout DSL
43
44 cliui exposes a simple layout DSL:
45
46 If you create a single `ui.row`, passing a string rather than an
47 object:
48
49 * `\n`: characters will be interpreted as new rows.
50 * `\t`: characters will be interpreted as new columns.
51 * ` `: characters will be interpreted as padding.
52
53 **as an example...**
54
55 ```js
56 var ui = require('./')({
57   width: 60
58 })
59
60 ui.div(
61   'Usage: node ./bin/foo.js\n' +
62   '  <regex>\t  provide a regex\n' +
63   '  <glob>\t  provide a glob\t [required]'
64 )
65
66 console.log(ui.toString())
67 ```
68
69 **will output:**
70
71 ```shell
72 Usage: node ./bin/foo.js
73   <regex>  provide a regex
74   <glob>   provide a glob          [required]
75 ```
76
77 ## Methods
78
79 ```js
80 cliui = require('cliui')
81 ```
82
83 ### cliui({width: integer})
84
85 Specify the maximum width of the UI being generated.
86
87 ### cliui({wrap: boolean})
88
89 Enable or disable the wrapping of text in a column.
90
91 ### cliui.div(column, column, column)
92
93 Create a row with any number of columns, a column
94 can either be a string, or an object with the following
95 options:
96
97 * **width:** the width of a column.
98 * **align:** alignment, `right` or `center`.
99 * **padding:** `[top, right, bottom, left]`.
100
101 ### cliui.span(column, column, column)
102
103 Similar to `div`, except the next row will be appended without
104 a new line being created.