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.
99
1010## Example
1111
12+ ``` bash
13+ npm i cliui@latest chalk@latest
14+ ```
15+
1216``` js
1317const ui = require (' cliui' )()
18+ const {Chalk } = require (' chalk' );
19+ const chalk = new Chalk ();
1420
1521ui .div (' Usage: $0 [command] [options]' )
1622
@@ -46,7 +52,9 @@ As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and
4652[ ESM] ( https://nodejs.org/api/esm.html#esm_ecmascript_modules ) :
4753
4854``` 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";
5058
5159const ui = cliui ({})
5260
@@ -57,11 +65,23 @@ ui.div({
5765 padding: [2 , 0 , 1 , 0 ]
5866})
5967
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+ )
6585
6686console .log (ui .toString ())
6787```
Original file line number Diff line number Diff line change @@ -11,3 +11,5 @@ export default function ui (opts) {
1111 wrap : wrapAnsi
1212 } )
1313}
14+
15+ export { ui as 'module.exports' } ;
You can’t perform that action at this time.
0 commit comments