File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,14 @@ easily create complex multi-column command-line-interfaces.
9
9
10
10
## Example
11
11
12
+ ``` bash
13
+ npm i cliui@latest chalk@latest
14
+ ```
15
+
12
16
``` js
13
17
const ui = require (' cliui' )()
18
+ const {Chalk } = require (' chalk' );
19
+ const chalk = new Chalk ();
14
20
15
21
ui .div (' Usage: $0 [command] [options]' )
16
22
@@ -46,7 +52,9 @@ As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and
46
52
[ ESM] ( https://nodejs.org/api/esm.html#esm_ecmascript_modules ) :
47
53
48
54
``` typescript
49
- import cliui from " https://deno.land/x/cliui/deno.ts" ;
55
+ import cliui from " cliui" ;
56
+ import chalk from " chalk" ;
57
+ // Deno: import cliui from "https://deno.land/x/cliui/deno.ts";
50
58
51
59
const ui = cliui ({})
52
60
@@ -57,11 +65,23 @@ ui.div({
57
65
padding: [2 , 0 , 1 , 0 ]
58
66
})
59
67
60
- ui .div ({
61
- text: " -f, --file" ,
62
- width: 20 ,
63
- padding: [0 , 4 , 0 , 4 ]
64
- })
68
+ ui .div (
69
+ {
70
+ text: " -f, --file" ,
71
+ width: 20 ,
72
+ padding: [0 , 4 , 0 , 4 ]
73
+ },
74
+ {
75
+ text: " the file to load." +
76
+ chalk .green (" (if this description is long it wraps)." )
77
+ ,
78
+ width: 20
79
+ },
80
+ {
81
+ text: chalk .red (" [required]" ),
82
+ align: ' right'
83
+ }
84
+ )
65
85
66
86
console .log (ui .toString ())
67
87
```
Original file line number Diff line number Diff line change @@ -11,3 +11,5 @@ export default function ui (opts) {
11
11
wrap : wrapAnsi
12
12
} )
13
13
}
14
+
15
+ export { ui as 'module.exports' } ;
You can’t perform that action at this time.
0 commit comments