Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ easily create complex multi-column command-line-interfaces.

## Example

```bash
npm i cliui@latest chalk@latest
```

```js
const ui = require('cliui')()
const {Chalk} = require('chalk');
const chalk = new Chalk();

ui.div('Usage: $0 [command] [options]')

Expand Down Expand Up @@ -46,7 +52,9 @@ As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and
[ESM](https://nodejs.org/api/esm.html#esm_ecmascript_modules):

```typescript
import cliui from "https://deno.land/x/cliui/deno.ts";
import cliui from "cliui";
import chalk from "chalk";
// Deno: import cliui from "https://deno.land/x/cliui/deno.ts";

const ui = cliui({})

Expand All @@ -57,11 +65,23 @@ ui.div({
padding: [2, 0, 1, 0]
})

ui.div({
text: "-f, --file",
width: 20,
padding: [0, 4, 0, 4]
})
ui.div(
{
text: "-f, --file",
width: 20,
padding: [0, 4, 0, 4]
},
{
text: "the file to load." +
chalk.green("(if this description is long it wraps).")
,
width: 20
},
{
text: chalk.red("[required]"),
align: 'right'
}
)

console.log(ui.toString())
```
Expand Down
2 changes: 2 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export default function ui (opts) {
wrap: wrapAnsi
})
}

export {ui as 'module.exports'};