pax_global_header00006660000000000000000000000064147657051560014532gustar00rootroot0000000000000052 comment=2737977df41e728bd8c7d3ca0658498273cecce5 yargs-cliui-2737977/000077500000000000000000000000001476570515600141755ustar00rootroot00000000000000yargs-cliui-2737977/.coveralls.yml000066400000000000000000000000561476570515600167710ustar00rootroot00000000000000repo_token: NiRhyj91Z2vtgob6XdEAqs83rzNnbMZUu yargs-cliui-2737977/.eslintrc000066400000000000000000000007101476570515600160170ustar00rootroot00000000000000{ "overrides": [ { "files": "*.ts", "parser": "@typescript-eslint/parser", "rules": { "no-unused-vars": "off", "no-useless-constructor": "off", "@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-useless-constructor": "error" } } ], "parserOptions": { "ecmaVersion": 2018, "sourceType": "module" }, "plugins": [ "@typescript-eslint/eslint-plugin" ] } yargs-cliui-2737977/.github/000077500000000000000000000000001476570515600155355ustar00rootroot00000000000000yargs-cliui-2737977/.github/workflows/000077500000000000000000000000001476570515600175725ustar00rootroot00000000000000yargs-cliui-2737977/.github/workflows/ci.yaml000066400000000000000000000026741476570515600210620ustar00rootroot00000000000000on: push: branches: - master pull_request: types: [ assigned, opened, synchronize, reopened, labeled ] name: ci jobs: test: runs-on: ubuntu-latest strategy: matrix: node: [20, 22] steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} - run: node --version - run: npm install env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - run: npm test - run: npm run check windows: runs-on: windows-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 22 - run: npm install env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - run: npm test coverage: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 22 - run: npm install env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - run: npm test - run: npm run coverage deno: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 22 - run: npm install - run: npm run compile - uses: denolib/setup-deno@v2 with: deno-version: v1.x - run: | deno --version deno test test/deno/cliui-test.ts yargs-cliui-2737977/.github/workflows/release-please.yml000066400000000000000000000032131476570515600232030ustar00rootroot00000000000000on: push: branches: - master name: release-please jobs: release-please: runs-on: ubuntu-latest steps: - uses: bcoe/release-please-action@v3 id: release with: token: ${{ secrets.GITHUB_TOKEN }} release-type: node package-name: cliui - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 14 - run: npm install env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - run: npm run compile - name: push Deno release run: | git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com git remote add gh-token "https://${{ secrets.GITHUB_TOKEN}}@github.com/yargs/cliui.git" git checkout -b deno git add -f build git commit -a -m 'chore: ${{ steps.release.outputs.tag_name }} release' git push origin +deno git tag -a ${{ steps.release.outputs.tag_name }}-deno -m 'chore: ${{ steps.release.outputs.tag_name }} release' git push origin ${{ steps.release.outputs.tag_name }}-deno if: ${{ steps.release.outputs.release_created }} - uses: actions/setup-node@v1 with: node-version: 14 registry-url: 'https://external-dot-oss-automation.appspot.com/' if: ${{ steps.release.outputs.release_created }} - run: npm install if: ${{ steps.release.outputs.release_created }} - run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} if: ${{ steps.release.outputs.release_created }} yargs-cliui-2737977/.gitignore000066400000000000000000000001041476570515600161600ustar00rootroot00000000000000.DS_Store node_modules .nyc_output package-lock.json coverage build yargs-cliui-2737977/.nycrc000066400000000000000000000002431476570515600153130ustar00rootroot00000000000000{ "exclude": [ "build/test/**", "test/**" ], "reporter": [ "html", "text" ], "lines": 99.0, "branches": "95", "statements": "99.0" } yargs-cliui-2737977/CHANGELOG.md000066400000000000000000000120731476570515600160110ustar00rootroot00000000000000# Change Log All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. ## [9.0.1](https://github.com/yargs/cliui/compare/v9.0.0...v9.0.1) (2025-03-17) ### Bug Fixes * make require("cliui") work as expected for CJS ([04ccc25](https://github.com/yargs/cliui/commit/04ccc250e30a059292c03fa1ef0a8661f8d93dfe)) ## [9.0.0](https://github.com/yargs/cliui/compare/v8.0.1...v9.0.0) (2025-03-16) ### âš  BREAKING CHANGES * cliui is now ESM only ([#165](https://github.com/yargs/cliui/issues/165)) ### Features * cliui is now ESM only ([#165](https://github.com/yargs/cliui/issues/165)) ([5a521de](https://github.com/yargs/cliui/commit/5a521de7ea88f262236394c8d96775bcf50ff0a4)) ## [8.0.1](https://github.com/yargs/cliui/compare/v8.0.0...v8.0.1) (2022-10-01) ### Bug Fixes * **deps:** move rollup-plugin-ts to dev deps ([#124](https://github.com/yargs/cliui/issues/124)) ([7c8bd6b](https://github.com/yargs/cliui/commit/7c8bd6ba024d61e4eeae310c7959ab8ab6829081)) ## [8.0.0](https://github.com/yargs/cliui/compare/v7.0.4...v8.0.0) (2022-09-30) ### âš  BREAKING CHANGES * **deps:** drop Node 10 to release CVE-2021-3807 patch (#122) ### Bug Fixes * **deps:** drop Node 10 to release CVE-2021-3807 patch ([#122](https://github.com/yargs/cliui/issues/122)) ([f156571](https://github.com/yargs/cliui/commit/f156571ce4f2ebf313335e3a53ad905589da5a30)) ### [7.0.4](https://www.github.com/yargs/cliui/compare/v7.0.3...v7.0.4) (2020-11-08) ### Bug Fixes * **deno:** import UIOptions from definitions ([#97](https://www.github.com/yargs/cliui/issues/97)) ([f04f343](https://www.github.com/yargs/cliui/commit/f04f3439bc78114c7e90f82ff56f5acf16268ea8)) ### [7.0.3](https://www.github.com/yargs/cliui/compare/v7.0.2...v7.0.3) (2020-10-16) ### Bug Fixes * **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#93](https://www.github.com/yargs/cliui/issues/93)) ([eca16fc](https://www.github.com/yargs/cliui/commit/eca16fc05d26255df3280906c36d7f0e5b05c6e9)) ### [7.0.2](https://www.github.com/yargs/cliui/compare/v7.0.1...v7.0.2) (2020-10-14) ### Bug Fixes * **exports:** node 13.0-13.6 require a string fallback ([#91](https://www.github.com/yargs/cliui/issues/91)) ([b529d7e](https://www.github.com/yargs/cliui/commit/b529d7e432901af1af7848b23ed6cf634497d961)) ### [7.0.1](https://www.github.com/yargs/cliui/compare/v7.0.0...v7.0.1) (2020-08-16) ### Bug Fixes * **build:** main should be build/index.cjs ([dc29a3c](https://www.github.com/yargs/cliui/commit/dc29a3cc617a410aa850e06337b5954b04f2cb4d)) ## [7.0.0](https://www.github.com/yargs/cliui/compare/v6.0.0...v7.0.0) (2020-08-16) ### âš  BREAKING CHANGES * tsc/ESM/Deno support (#82) * modernize deps and build (#80) ### Build System * modernize deps and build ([#80](https://www.github.com/yargs/cliui/issues/80)) ([339d08d](https://www.github.com/yargs/cliui/commit/339d08dc71b15a3928aeab09042af94db2f43743)) ### Code Refactoring * tsc/ESM/Deno support ([#82](https://www.github.com/yargs/cliui/issues/82)) ([4b777a5](https://www.github.com/yargs/cliui/commit/4b777a5fe01c5d8958c6708695d6aab7dbe5706c)) ## [6.0.0](https://www.github.com/yargs/cliui/compare/v5.0.0...v6.0.0) (2019-11-10) ### âš  BREAKING CHANGES * update deps, drop Node 6 ### Code Refactoring * update deps, drop Node 6 ([62056df](https://www.github.com/yargs/cliui/commit/62056df)) ## [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10) ### Bug Fixes * Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae)) ### BREAKING CHANGES * Drop support for node < 6. ## [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23) ### Features * add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902)) ## [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18) ### Bug Fixes * downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46)) * set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36)) ### Chores * drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376)) ### Features * add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922)) ### BREAKING CHANGES * officially drop support for Node < 4 ## [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11) ### Bug Fixes * reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33)) ### Features * adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32)) yargs-cliui-2737977/LICENSE.txt000066400000000000000000000013331476570515600160200ustar00rootroot00000000000000Copyright (c) 2015, Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. yargs-cliui-2737977/README.md000066400000000000000000000064441476570515600154640ustar00rootroot00000000000000# cliui ![ci](https://github.com/yargs/cliui/workflows/ci/badge.svg) [![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) ![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/cliui) 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]') ui.div({ text: 'Options:', padding: [2, 0, 1, 0] }) 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()) ``` ## Deno/ESM Support 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 "cliui"; import chalk from "chalk"; // Deno: import cliui from "https://deno.land/x/cliui/deno.ts"; const ui = cliui({}) ui.div('Usage: $0 [command] [options]') ui.div({ text: 'Options:', padding: [2, 0, 1, 0] }) 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()) ``` ## Layout DSL cliui exposes a simple layout DSL: If you create a single `ui.div`, passing a string rather than an object: * `\n`: characters will be interpreted as new rows. * `\t`: characters will be interpreted as new columns. * `\s`: characters will be interpreted as padding. **as an example...** ```js var ui = require('./')({ width: 60 }) ui.div( 'Usage: node ./bin/foo.js\n' + ' \t provide a regex\n' + ' \t provide a glob\t [required]' ) console.log(ui.toString()) ``` **will output:** ```shell Usage: node ./bin/foo.js provide a regex provide a glob [required] ``` ## Methods ```js cliui = require('cliui') ``` ### cliui({width: integer}) Specify the maximum width of the UI being generated. If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`. ### cliui({wrap: boolean}) Enable or disable the wrapping of text in a column. ### cliui.div(column, column, column) Create a row with any number of columns, a column can either be a string, or an object with the following options: * **text:** some text to place in the column. * **width:** the width of a column. * **align:** alignment, `right` or `center`. * **padding:** `[top, right, bottom, left]`. * **border:** should a border be placed around the div? ### cliui.span(column, column, column) Similar to `div`, except the next row will be appended without a new line being created. ### cliui.resetOutput() Resets the UI elements of the current cliui instance, maintaining the values set for `width` and `wrap`. yargs-cliui-2737977/deno.ts000066400000000000000000000006101476570515600154670ustar00rootroot00000000000000// Bootstrap cliui with CommonJS dependencies: import { cliui, UI } from './build/lib/index.js' import type { UIOptions } from './build/lib/index.d.ts' import stringWidth from 'string-width' import stripAnsi from 'strip-ansi' import wrapAnsi from 'wrap-ansi' export default function ui (opts: UIOptions): UI { return cliui(opts, { stringWidth, stripAnsi, wrap: wrapAnsi }) } yargs-cliui-2737977/index.mjs000066400000000000000000000005371476570515600160240ustar00rootroot00000000000000// Bootstrap cliui with CommonJS dependencies: import { cliui } from './build/lib/index.js' import stringWidth from 'string-width' import stripAnsi from 'strip-ansi' import wrapAnsi from 'wrap-ansi' export default function ui (opts) { return cliui(opts, { stringWidth, stripAnsi, wrap: wrapAnsi }) } export {ui as 'module.exports'}; yargs-cliui-2737977/lib/000077500000000000000000000000001476570515600147435ustar00rootroot00000000000000yargs-cliui-2737977/lib/index.ts000066400000000000000000000217641476570515600164340ustar00rootroot00000000000000'use strict' const align = { right: alignRight, center: alignCenter } const top = 0 const right = 1 const bottom = 2 const left = 3 export interface UIOptions { width: number; wrap?: boolean; rows?: string[]; } interface Column { text: string; width?: number; align?: 'right'|'left'|'center', padding: number[], border?: boolean; } interface ColumnArray extends Array { span: boolean; } interface Line { hidden?: boolean; text: string; span?: boolean; } interface Mixin { stringWidth: Function; stripAnsi: Function; wrap: Function; } export class UI { width: number; wrap: boolean; rows: ColumnArray[]; constructor (opts: UIOptions) { this.width = opts.width this.wrap = opts.wrap ?? true this.rows = [] } span (...args: ColumnArray) { const cols = this.div(...args) cols.span = true } resetOutput () { this.rows = [] } div (...args: (Column|string)[]): ColumnArray { if (args.length === 0) { this.div('') } if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') { return this.applyLayoutDSL(args[0]) } const cols = args.map(arg => { if (typeof arg === 'string') { return this.colFromString(arg) } return arg }) as ColumnArray this.rows.push(cols) return cols } private shouldApplyLayoutDSL (...args: (Column|string)[]): boolean { return args.length === 1 && typeof args[0] === 'string' && /[\t\n]/.test(args[0]) } private applyLayoutDSL (str: string): ColumnArray { const rows = str.split('\n').map(row => row.split('\t')) let leftColumnWidth = 0 // simple heuristic for layout, make sure the // second column lines up along the left-hand. // don't allow the first column to take up more // than 50% of the screen. rows.forEach(columns => { if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) { leftColumnWidth = Math.min( Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]) ) } }) // generate a table: // replacing ' ' with padding calculations. // using the algorithmically generated width. rows.forEach(columns => { this.div(...columns.map((r, i) => { return { text: r.trim(), padding: this.measurePadding(r), width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined } as Column })) }) return this.rows[this.rows.length - 1] } private colFromString (text: string): Column { return { text, padding: this.measurePadding(text) } } private measurePadding (str: string): number[] { // measure padding without ansi escape codes const noAnsi = mixin.stripAnsi(str) return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length] } toString (): string { const lines: Line[] = [] this.rows.forEach(row => { this.rowToString(row, lines) }) // don't display any lines with the // hidden flag set. return lines .filter(line => !line.hidden) .map(line => line.text) .join('\n') } rowToString (row: ColumnArray, lines: Line[]) { this.rasterize(row).forEach((rrow, r) => { let str = '' rrow.forEach((col: string, c: number) => { const { width } = row[c] // the width with padding. const wrapWidth = this.negatePadding(row[c]) // the width without padding. let ts = col // temporary string used during alignment/padding. if (wrapWidth > mixin.stringWidth(col)) { ts += ' '.repeat(wrapWidth - mixin.stringWidth(col)) } // align the string within its column. if (row[c].align && row[c].align !== 'left' && this.wrap) { const fn = align[(row[c].align as 'right'|'center')] ts = fn(ts, wrapWidth) if (mixin.stringWidth(ts) < wrapWidth) { ts += ' '.repeat((width || 0) - mixin.stringWidth(ts) - 1) } } // apply border and padding to string. const padding = row[c].padding || [0, 0, 0, 0] if (padding[left]) { str += ' '.repeat(padding[left]) } str += addBorder(row[c], ts, '| ') str += ts str += addBorder(row[c], ts, ' |') if (padding[right]) { str += ' '.repeat(padding[right]) } // if prior row is span, try to render the // current row on the prior line. if (r === 0 && lines.length > 0) { str = this.renderInline(str, lines[lines.length - 1]) } }) // remove trailing whitespace. lines.push({ text: str.replace(/ +$/, ''), span: row.span }) }) return lines } // if the full 'source' can render in // the target line, do so. private renderInline (source: string, previousLine: Line) { const match = source.match(/^ */) const leadingWhitespace = match ? match[0].length : 0 const target = previousLine.text const targetTextWidth = mixin.stringWidth(target.trimRight()) if (!previousLine.span) { return source } // if we're not applying wrapping logic, // just always append to the span. if (!this.wrap) { previousLine.hidden = true return target + source } if (leadingWhitespace < targetTextWidth) { return source } previousLine.hidden = true return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft() } private rasterize (row: ColumnArray) { const rrows: string[][] = [] const widths = this.columnWidths(row) let wrapped // word wrap all columns, and create // a data-structure that is easy to rasterize. row.forEach((col, c) => { // leave room for left and right padding. col.width = widths[c] if (this.wrap) { wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n') } else { wrapped = col.text.split('\n') } if (col.border) { wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.') wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'") } // add top and bottom padding. if (col.padding) { wrapped.unshift(...new Array(col.padding[top] || 0).fill('')) wrapped.push(...new Array(col.padding[bottom] || 0).fill('')) } wrapped.forEach((str: string, r: number) => { if (!rrows[r]) { rrows.push([]) } const rrow = rrows[r] for (let i = 0; i < c; i++) { if (rrow[i] === undefined) { rrow.push('') } } rrow.push(str) }) }) return rrows } private negatePadding (col: Column) { let wrapWidth = col.width || 0 if (col.padding) { wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0) } if (col.border) { wrapWidth -= 4 } return wrapWidth } private columnWidths (row: ColumnArray) { if (!this.wrap) { return row.map(col => { return col.width || mixin.stringWidth(col.text) }) } let unset = row.length let remainingWidth = this.width // column widths can be set in config. const widths = row.map(col => { if (col.width) { unset-- remainingWidth -= col.width return col.width } return undefined }) // any unset widths should be calculated. const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0 return widths.map((w, i) => { if (w === undefined) { return Math.max(unsetWidth, _minWidth(row[i])) } return w }) } } function addBorder (col: Column, ts: string, style: string) { if (col.border) { if (/[.']-+[.']/.test(ts)) { return '' } if (ts.trim().length !== 0) { return style } return ' ' } return '' } // calculates the minimum width of // a column, based on padding preferences. function _minWidth (col: Column) { const padding = col.padding || [] const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0) if (col.border) { return minWidth + 4 } return minWidth } function getWindowWidth (): number { /* c8 ignore next 5: depends on terminal */ if (typeof process === 'object' && process.stdout && process.stdout.columns) { return process.stdout.columns } return 80 } function alignRight (str: string, width: number): string { str = str.trim() const strWidth = mixin.stringWidth(str) if (strWidth < width) { return ' '.repeat(width - strWidth) + str } return str } function alignCenter (str: string, width: number): string { str = str.trim() const strWidth = mixin.stringWidth(str) /* c8 ignore next 3 */ if (strWidth >= width) { return str } return ' '.repeat((width - strWidth) >> 1) + str } let mixin: Mixin export function cliui (opts: Partial, _mixin: Mixin) { mixin = _mixin return new UI({ width: opts?.width || getWindowWidth(), wrap: opts?.wrap }) } yargs-cliui-2737977/package.json000066400000000000000000000031371476570515600164670ustar00rootroot00000000000000{ "name": "cliui", "version": "9.0.1", "description": "easily create complex multi-column command-line-interfaces", "main": "build/index.mjs", "exports": { ".": "./index.mjs" }, "type": "module", "module": "./index.mjs", "scripts": { "check": "standardx '**/*.ts' && standardx '**/*.js'", "fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js'", "pretest": "rimraf build && tsc -p tsconfig.test.json", "test": "c8 mocha ./test/*.mjs", "postest": "check", "coverage": "c8 report --check-coverage", "precompile": "rimraf build", "compile": "tsc", "prepare": "npm run compile" }, "repository": "yargs/cliui", "standard": { "ignore": [ "**/example/**" ], "globals": [ "it" ] }, "keywords": [ "cli", "command-line", "layout", "design", "console", "wrap", "table" ], "author": "Ben Coe ", "license": "ISC", "dependencies": { "string-width": "^7.2.0", "strip-ansi": "^7.1.0", "wrap-ansi": "^9.0.0" }, "devDependencies": { "@types/node": "^22.13.10", "@typescript-eslint/eslint-plugin": "^4.0.0", "@typescript-eslint/parser": "^4.0.0", "c8": "^10.1.3", "chai": "^5.2.0", "chalk": "^5.4.1", "cross-env": "^7.0.2", "eslint": "^7.6.0", "eslint-plugin-import": "^2.22.0", "eslint-plugin-n": "^14.0.0", "gts": "^6.0.2", "mocha": "^11.1.0", "rimraf": "^6.0.1", "standardx": "^7.0.0", "typescript": "^5.8.2" }, "files": [ "build", "index.mjs", "!*.d.ts" ], "engines": { "node": ">=20" } } yargs-cliui-2737977/renovate.json000066400000000000000000000001601476570515600167100ustar00rootroot00000000000000{ "extends": [ "config:base" ], "pinVersions": false, "rebaseStalePrs": true, "gitAuthor": null } yargs-cliui-2737977/rollup.config.js000066400000000000000000000004311476570515600173120ustar00rootroot00000000000000import ts from 'rollup-plugin-ts' const output = { format: 'cjs', file: './build/index.cjs', exports: 'default' } if (process.env.NODE_ENV === 'test') output.sourcemap = true export default { input: './lib/cjs.ts', output, plugins: [ ts({ /* options */ }) ] } yargs-cliui-2737977/screenshot.png000066400000000000000000000435151476570515600170700ustar00rootroot00000000000000‰PNG  IHDR8�6Y•ÕPiCCPICC ProfileX ­YgTÍÒî™Ùì’sÎQr‘œs¢²ä .IP‘ "DÁ¨ FDD@‚‘¤‚¢" (*@äëÅð¾çž{ÿ}sÎÌ<[]]óTuO÷T-djll$Ê @Tt<ÍÅÒDÔËÛG”ø0&À 4+5 .ÖØÉÉüÏcn ôƇŠt[ÿSí¿7°Å€8ÁfÿÀ¸€(ˆ¯€cˆ¥Å€ï€r‰¤øX:ž„˜“ B¼DÇ!«˜ÙNÿ_XrUÇÍÅ‚$2•J €Ù ÊEB æ@ØÆ »m�x]@(Êø Îš¨¨:‡XÖÿ_vBþ…©Tÿ¿6©Ô�¿ø—/°'|°YX\l$5yõÇÿç%*2ÆkõƒWr(ÍÊÞ9aÜÊ"blé˜ ñ…hGˆÙ!n ƒýÆ=¡ VîÓõGâLa,7Äß©f¶ €2&D¸ÿÆÒTD«ú¨IX¼µÛoìA‹qùm �Žt ÏhÝdý Š3w…rÈ ³°†ŽZ•êæ 1ä‰6$†y8@Ì qG\„+�ÝÎ@J¨)]¾ªCKp¡s–„òÉ`šÝG¨ƒ‘£â Zµ�‰PWŸÅ åñ¡nVPûbv�AfæÃçb^AÑî¿ù`¡±ñ&t;tý”ØÈÕù ybƒ"-érqˆ+ã]ÿô½Os£ËaܰÁpª }¾BÎØ»Øx'zLè|¾;` Ì€(H€§?ˆá ¬gúÚ4üõ«ÅP „€  ø[ò§‡çjK4¼º‚ðDC�¸¿ýLV[ƒ@"”/ÿ•þê«‚W[W{D€·ð Q8~Ü:œ>Î^�੆ÓÁéþé'Êò‡'Áœ`F°"XäþH@d Oû/2[ؽ£Ákôþ±‡‹ïÇ¿Æ?Æ�âŸ0¾jå·§›ÂÒiüµlF¡µ_Q ‚‹StpÒ�µ&ÎgùCî8n?PÄi@OŒq†Ð7M(ý=:ë„¿Üþ‰åŸ¸ÿÑ£³ý—�¿åÌòÌš¿Yøÿñ ŽäŸHü§•ZÂ@ Ô²ýOM, »ŒÝÁna÷°&ìÅZ°¬»IÇ¿9[¬F'äïÓ\V#}û££R£2¥²ôç×__©PBg@8ÿヶÄÃùLcb“ia!¡ñ¢ÆpµŽPZ#ª¦¢ª }M§ëðÕeu­F¸{ÿ‘Q#ÐQ€ÑäY \j‹à´>ü�L¾�|º\r H %þ²‡£ßðp·`�o@ú¤´€>0æÀ87à 6¨‡‚(È: l;A&È@8Žƒ P΃Kàh·Àmpô�ÇàœoÀ{0æÀ"‚ D„‚p |ˆ"…( jˆ²1GìÄñCB�h$Ù†ìBr‘ƒÈä$R�\D®#·�{H?òy…L!_�(†’QNT•F•QÔµEÝÐ hºMA3Ðýh ZŽžCëÑ[è}ô1:оGg1€1aܘ¦ˆé`¦˜#æƒc4,ËÁбr¬k„cýŦ±Ç�Å)Âùi…sÇà6ãRq{qGpU¸z\î!în÷OÁ âðzxk¼>Ÿ„ÏÄãOã¯â;á»ó?G ¸ 2mønz [ { G u„VB?aŒ0K$ùˆ D¢#‘JŒ'fÏ[ˆÄ7Äï$&’I�dAò!E“ÒIŤ³¤fÒi‚´ÈÀÊ Å ÇàÈÈ�Ì�ÇPÉÐÈÐËð†a‘‘�Q†Ñ€Ñ�1œq'c c-c'ãsƯLLLâLºLÎLaLiL%L˜î2½bZ ³“åɦd_ry?ù ¹•ü”ü•B¡HSŒ(>”xÊ~J5¥�2BùÎÌÁ¬ÄlÍȼƒ¹”¹žy€ù# ‹‹1ËF––b–Ë,½,Ó¬ ¬Ò¬¦¬TÖTÖRÖë¬C¬³llªlŽlQl{ÙβÝc›d'²K³›³²g°W°·³�q`¦»8*9:9Þp8e8­9Ã9s9ÏsöpÎp±sipypmá*åºÉ5Ê�qKs[sGrçq_âäþÁ#ÄcÌÄ“ÍSË3À3Ï+ÀkÄÄ›Ã[Çû˜÷Ÿ(Ÿ9__>ß5¾ü8~y~gþ$þcü�üÓœú9—†QAyAÁ­‚‚Ý‚³BÂB–B±B‡…Ú…¦…¹…�„Ã… …›…§D8DÖ‰„‰Š´ˆ¼å5�-í�³K;)Ö#¶(.#î.ž.^'þB‚QBG"X¢P¢MbFRDÒ^r›d�ä°ƒ”ŽT¨Ô!©;RóÒ2ÒžÒ{¤¯IOÊðÊXˤÈÔÈ<—¥ÈÊn–-—}$G�Ó‘‹�;*×'�ÊkʇʗÊ÷*  Z a Gú×à×讉^S¾fH‘¬h¬˜¨X£øJ‰[ÉN)]éšÒGeIeå|å;Ê?U4U"U*Už©²«Ú¨¦«6ª~Q“W P+U{¤NQ·PߡޠþYCA#Hã˜ÆMM{Í=šmšËZÚZ4­Z­)mIm?í2í!N'�½:wuñº&º;t›tô´ôâõ.é}ÒWÔ�Ð?«?¹VfmÐÚʵcâTƒ“£ëD×ù­;±nÔPÌ�jXnøÚHÂ(Ðè´Ñ„±œq¸ñ9ã�&*&4“«&ó¦z¦ÛM[Í03K³³svswó#æ#â!53–š–[-[­ðV¶VùVCÖBÖÖÕÖ36Ú6Ûm:lɶ®¶Gl_ÛÉÛÑìíQ{ûûçRÑ×�£µc�ã '§ÍN7œ ÎNÎ¥Îo]T]¶¹ÜqåpÝäzÖuÎÍÄ-Ïí™»¬{‚{›‹‡¯GµÇ¼§™çAÏQ/e¯í^÷½ù½Ã¼|ˆ>>§}f×›¯/ZÿÆWÓ7ÓwpƒÌ†-îmäß¹ñæ&–MÔM—ýð~ž~gý–¨ŽÔrꬿµ™ÿL€iÀ¡€÷�F�…�SAAƒ&‚ ‚O†„„L…†‡N‡™† ûn~<|>Â1âLÄJ¤gd])Ê/êz4{tDtGŒpÌ–˜þX…ØÌØÑÍz›‹6ÏÐli§ã�¸ q ñœðã¹;A6aw«Äu‰¥‰ß“<’.oaÛ½¥;Y>9;y"Å"åÔVÜÖ€­mÛĶíÜöj»ñö“©HªjÛ‰;Þ¤Y¦UídܱóAºJúÁôo»¹~æZèµÑï†þë6×Ûõ¯ÞPºq¦I¬©ô&×ͼfÆæŒæ•–”–ÙÖØÖé[!·ÆÚ6µ=k÷jÔáÜÑÓiÛy÷¶Åíö;ÆwZîÜmº§wïz—N×µûZ÷ë»5»¯>Ð|pµG«§¾W»·¡O·¯±mó€áÀ­‡fo?²~tÿ±ÃãþA÷Á'C¾C£OŸL>�|úy8qxñYÚsüóœ¬/ŠGGÊ_ʽ¬Õ½ùÊìU÷k××ÏÆÆÞ�Ç�/½ÉxKy[,}üXs?84Tõ$ñ©Ñ0aøœ_šÏ'^ä�è�Œ½Ü7ª?úþÕñ×.cØXݸûøÂ›Â·kÞ¶L¸LŒOîžRžWõ>zZ}zöCÝÇ€OlŸ®Î8ͼý¼í Ï—Û_ó¾EÏRç‚á<ÿѹ¬´²²:þÈ4SÃ&qñi/¢I‘A†Q†Iœ¬BÑcvf `Me;ÎÞÌ1ÅÅÊ­ÃCåÍâ»Â?"È$¤.¼^$Mô¤X‹ø3‰Y)&iMYk9?ùd…‚5»•&UpªbjkÕ}4â5sµ*µ¯ë<Ð}­÷m-Á@`�ª¡½Q¤qžÉÓ>³$K!+5kswÛ»hû-©Ž»œv;gºd¹æ¸íuÏñÈðLö õvó1[oèk±ÁgcÒ¦"¿ Ô6ÿ®€ÎÀ«AeÁ[Cœ«Ùp®ìüÓ:Î ³àêµpU©>ðZiÃ@#þ†FÓ¦›»›O·4µ6ß:Ûv }{GRgÚí¼;GïVÜ;Öµÿ~B·ëÅ\Ïp量Üþðç‡æ�Ì;ú%<Éxºgxû³àç¦/ø_L�\¹gÔë•âkÒë·cíãGßl~k4Ažx4Y1µã]ØûÀéÐQc?ÅÎÄ~¦}Iüšü-i6lÎržeþòwóï÷|>üè["/¯Ž¿è@l‘'hFÀòp ¸^| A™0Eeke¯æ(àÜÎÂíÂcÀ+ÇÇÅ·Ä?)0 Ø,T+\!R*Z,V(ž'‘)™(E•6—•ù.Û-w\>NÁj�˜"ª8¥4¤|W¥Qõ¬Z‰zš†Ÿ¦®A«W»HÇK—O÷©ÞQýÀµjƒ‘uõ†yF¡Æf&Ò¦¬fÀì«ù„Å å «bë )›QÛ;G{¢}»Ã.Gk'^§wÎÍ.®¡núî÷�óžÛ¼l¼¹¼_úT­��ûÿ†›Ó6™ú‘üú©eþkÉ�ÃAg‚7‡è„,…¶„¥…E€ˆÖÈ�Q¦Ñ¸èΘݱƱß7×мáž]ïÿ-¡$qmâHRÚ¡-7“ýR¸S†·ÖlÛµÝ+U6unG{ZÁÎ�t³]ò¼»™2Aæ·=cY²ëröæR÷jì#îÞ!/ç@D¾åAöƒ· ÖL¦›Ê:L:’S:~”ï˜Úqݺ'5Ë•+d+ÅNñ�f;ÃXÅPÍg’Á9¿ó{jÏ×=¼°tIö²Ï•ƒWû¯q6x_/kjÂß”k¶lñoÝqëX[sûËŽ•ÛbwLï†ÜÛÛuñþ`÷r�\ïú¾Cý#Õí{üqÈõÉõa±gE/”_2¿JÏ�LþàðenÁ™>þ¿joô=� @Ì3=öÁs €ükH߀‡' nºÝS PËZ€Dìþ» H0çä"@hÀLÓøÀÌy Ȇå9Ð `d aGä#˜Æ!û`>؉Œ¡*†š �è˜å  ?0 ÌKÁª°! §‡‹ÂUàžâÙñ¶0#k' #B¡�ˆ'ÚŸ�ÄH‘¤ë DO†*†ŒöŒ'癘ªÈ8²?¹�"Eɦ|dvcn‚™N>+`ÝÌ:ÎæÍÖËnÁ~“C‡£žS�³�Ë…kŒ;�‡ÀSÌ+ÍÛÀçÀ7ÉŸ% *0&x\È_XAø»ÈmÑ"±@q ‚Ä3ÉËRyÒ‘2¶² r¹ùÇ 7ÖSLUòUÖUáT™Q} vV=[#TÓFKI›K{EçƒîˆÞ€~×ÚNƒŽuw {Œ†�'MæÌ€9®s$+’5ƒ Ù–ÓNÌ^ÃÁÁ1کйÉå�Å]ÃÃÛs»× ïŸ _¦ *=6mó«¤öø” r ÞÒú#Ü4âpäBt@ÌÀf ZS¼FB]’â–‹)k·öm�Ù!˜6˜^˜a·{nOaöšœÎ½Aû¹ò^æ?(xQ´R"zD·ÌîØ¦Éå'*‡Ï(VŸ8§R;zñä•�ט®×6mhQhé´¸[ÞMî•íŸ{”?$û´ÿù±—‡^¼õ›ZøÀþéÜðMeNw~e!çGÃ⣥Ë?cW´W×dµæÀ€4¬5{à k © T‚ë Ö –nD±A‚aE V^£8TµCiè´ý„ b¶Ø6¬‡•2\.®�à ð[ñ7ðKCÂ.Â="+Ñ›xŠø…dL* ½eÐg(`˜f´€c¾ÄäÅtfÂ4ò#Š.å3óæ o–V ÖV¶ul-ì¦ì]®/`fúƒ+�[žû>Ïf^nÞz>g¾·üÉ�JA#Áq¡|af‘¢—Åö‹‡I˜HòJ¾—º)}@&XÖDNJž]�´¯HRbVfWaS%©.¨MªitiÞÒº¥Ý¥óL÷‹>óZçua†ñF4ãP/SK3]s KK«MÖ©6'mïØÍ88š;EÀ=­Ðõ�[‘{¡Ç ϯÏ>šëÓ|lÞï×ë/Xt5¸'d~yANÁE¡ "E£ÄìÄU$x% ’ RŸ¥?É|•]–gV�\c¤è§”¦|T¥Aõ¡ÚW ~Mk­tív]²ž¯þ"üVm67)0ã6¯µô±f³é·;âãäî¢æ:ìîãÑíeåýp}°ï÷�»üj¬ÿã@í ²†Ð�áŒQö1 ö-&^8¡=)!9pëÇÔÊ´ä�ƒéKènR&ëõ¬¸ìG¹î{§ögPÊZ�U¤_ü¹¤úÈÆ2Æ£gŽkŸ¸YnXÑzÊìtW•Sõ£·s}µu×/Ê^:t…tu{ýRCv£ô�¾›é-Z­SmeŽ·qwnÜ‹»¯Ð=Þs¬Ïk€óáÀã¼!›'+Ãçž;¾˜|™0ºü:}{“>�Nîz‡{¿cúãG‹OÉ3G?ïû’ðÕìëü·³³³ÏæBçææç§¾û~ï]0]¨ùAùûc`Qs±dñó’õRùÒâ²ÛòùŸØO¯ŸçV�÷•³ôñ� V‡õJx dX~YYù* ñ Ëù++‹å++Ë0Ùx@kä¯ÿsèÊôÿ‰Ê^ÒQ—üã4úýßÇÿù¢Ëê™�iTXtXML:com.adobe.xmp 568 157 9\­ë-IDATxí� XSWºï4 Q±Š·~ÔúY -N/�ÞN;¡GçÌ4LÇÞεp§Nï€wž^…{¦íÀ=-Ì3Nì9ÃÌX蜟=u`Zái ÓÐAçLh:nÔ ‚•¨DMÐlI”»öÎ;ÉN„`ÀÿzxÈÞk¯õ®÷ý­�õîõ‘½b €€D+�)ѪôŽ€fC·ÉF9$,\œ,�P@Öîî^­E^õ«òN³7D,H µ&p�Êahkh5ø‘u˜�F£Ùê0‚y/û^>”A®€â"|ÁØÖPÓÔå,Äʼ¹„×üéÊ#¡i{殆ºCFê?Ç:ŒÎÞ±Öò@Æ›€ÀQ±m™11emf§ {sbbrÚØñV(ôò?~µöœWzG÷®¬ØÙóæÍ›��YT¢Û‰�ž@H1£ïy)-ÉKZTžœ;üê³�ÿÑYI2ùÖÞm!!s¤±¡+;&ö²ÝM%%û bÞÈvrÿå£\uŒÃèìc% @`Ü ûo¿AÛy«Ý.ˆŠšC‡¹coQNܺÌ·23s*šºyÕu//yµVQÍèu�ªæ�ÏæìmMe ‘Ï[²8%IZòÛš*>a)‘'º(%Òä”5+#Uh ì•ØNíØ¡º(æ¨di/jZ´kãFªUéGio’‘@ Š x9*‹Ÿ¢Îu‡±½¬ +Æ2óš Î~–£uÿ®¬4WtŽàùÚal-r^È**+ÉË)ipŭš]yÎ Y‚.ÛQ““••ST'ˆóÓÆÁþaóêÍÇi©-”çîS¿¾� ðí%«{g7ÉÞ·gcêâ¸þ+4míæÿèkIÉÆZkòh“ i­.1Ö® 7‡œ’çèÕ<+-3“rÈÌ)*¢ÝИ´¼ý´Ç(ž�@ܬ5E”@I�.-«¤ÝÕ¹%ži9Eï6Ö’9BMí7„g£;³‹>¦P}2sòrx™y]|-²û3cÒžzn!̺ Îð<ÏÛ^�™–õ“×ßùàð%!ùÀòØ+z¿9m {GG ¹@nº<ÝlZúh®Öšœ§L¹’¥ÖÂ�iÕôJn‹N¯ïdªÕÅÕ:>vÐR�Ÿ«®méìéÑ3õÙÔ€ÂF>¯žFE±¦S¯ÙÇE9/Ôĉ$¹õŒ¾W¯)¦"åê^gaƒƒ­šK)W»ŠwÇ‹}Z*iÞ‹®\©b< lº}T@¹Î>Ø[ÏI’ÓJ�SSO"±¦\Aä儽-*.sñ>j1Ó²/7·Ò©?‡�d×3�ºNRXOåYª¹¢ZÓXHKTªµZN�}�¶@ñ4Gn–JŽQÑ´ÕÜ¡O½^S™Ï¥P µµPõj­˜eâq~öšDí¢zòõÅéãªßì}6*ÒÖÃ0:M5­Yye £c´:½žÝÄhµ�•¹ˆ€|@ùì t¿9ͱ½â  0q�!U;ª–bÚç¶töÚìCÉ�G&½®¥±±EÓRN['ÞÍX˜rÚ––3\›F[5®1Rp «Ó‘�Â}ZmK‹F[«¢ä-n¿dëÑ”«ÕåÕg6§ð@ÿ®)äƒ"¿²^kâµ²uVÓ¨J-£–Ó†›±è*iÁNGHŽ3Þ¯áæšB§Î^MJA¥qiìrä6ÞQÉËí•´ÜrÝà Ž¦Òš8G%ï”éÏ�s Ôcª4Ε\”§Ÿn#n¸}í `—�>=õÔ3 ¹›ŽÖ²B+V[®Knç5š|�½Ôü ÷›S«9f¯JÄ €À$à5ôçjýÎ)ªû7•æ+ÞzôÞyq±t€«¨Õ5ôg¬È‰™½dõ¿TøàýŸ¢súÓÝ‹»÷/qNøHæ/u‰³Û¹Q½ì¾/+*ªªÞ©øøÂÒüü´[\ƒ‚Ò”Œ¼­[ó6f„2O”úB…¥·³žúÆæÝ›7¬›½®„[ügï§ÿ6¯“o#ª[Sõ9H'ÝF=ŦÈzPæRÜõa=ÓÊ"�u™8ÿþ‡ ±¸æð˜,‘¬Þ(ï»J ´ÓT—âñA¸ -‹ˆO¤à†x>èæ¹ø!oµÂ> f—`™†lÞ|Z”g͆Ëp1¾>óš!ÊÚà~ ÛT˜˜Üž…jïjt\1±ÓiÔÒD~J\¶,³´i°”þjG÷×–oÈ­Ry%ƒíølKÙ§³mZÅ5ËME»«4Í׳©4ÞqñŒ'’;ØðJé¦e^1Î: öÉßÎLKZñÄ·V tI錒%/{âáû”å�׊YRzκ=eÉ::üXE�~%™�s7¨¿H›;Ú)ýæ¦ÇÖt¡&²»àFÝ¡O×N¡§á¦Ññ‰sˆËíºñŸ>ñA¹ 3 g ›™6�ãlë>.L3ÇÁíês—à¸v•z;¦„X¡ýî”®8÷¥àòÝ™èç�½¢÷› %Aî,‚U\ârB¶•V¶ÌÆîC¥µD™¶„kªÙ¦Š²ºÖ³-vöœ¤xú”�HÿéœÙôÿѣǭ¬µ£¡ìñ�®Uƒ²Ôõt�hËö7Z»ºÛjÞØ\ËÅÓ™uYê÷Š yþ™¢C]F³ÙØÕÖ°«lhé„í\³R©ÜðÒ§!,¦0ïÍÉ)khÓž8s¦íÏû¼K‡9‡*]®äF®› ­{×mkV¨s– ] ½R�­ÏÏ'µÏïØ{ÈheÍÝ­e»x=“—m¤|~¶»Ýh5w5•n®"ÙÙk|º]!ÈÄ-PVÙêǨY¥ïw[Ù®¦7·PžÔÿ RsOá„ÀvÑuû̶Í5ô†0´½ñÒ¢xn…—½µÍŸ· ݳË?³f£ÁhÔ÷ôRuÎë F%°üZ‹ßožÄáÚë„�‰B@8\ibø9|§êòü–ç””­:_ЗP»×[XêUÜ >(²é¼Ž{’ßÞÓ’ëÌ!ÏÎåâ+]&†›™ry~­gŽÃ9³5”R¨–ï±�©V)=) ;Ýó!·Fƒòü}ž•¾¼Ï¹Ù&¹ªÓd²x´´k�Ë@œ²ò«�W8»\â©QÅÎ5%ü\”š&`Ô ¹š¡sTŠZk OgYpãg›Ê©.pZñs{ôØÂT{ÌR yÚm“ŽºÿÍÙøÛ+j-Ö¹ØÁmqnK¯pŠÒTë®}ϼ¿èÆ�œÿtNé’Ï-±7ÐýFçGc/�ÿ@&0Áb —v‹©—6Ú¾6Ùm&±xÚrôöš†Zxßl6n�€÷š4>‡É]†oÖáÎ-Z]Zè—Ên₟þ~é<ü²®Yõ,”p]²Yz{{-aëL¯Ø©Á½#‘ï)Hx07aZþØÎ+ã­‹Ë»�ÂQ ¼ˆ»$»<ŽÓ´ŠÝ†ùô—4ƒØý6:{ƒƒ‹ €@ Õ‘oµÆò_[YÖºƒKËÿ׃Wÿ¢zõ-¦’±¼�ê5f4&…YÛ*~zøÁ÷¶¦‡-ÍÁ²ÜXšD:±ÞôÇÙ=*ÕCÌd­HKØó¼†ÎG†MxÌ„¨ú˜•A Q@ "ŽÊØÞPùj?~Æzך-/¬O¥‹&¶aWáÉoäoÍ\<áT‡Â “‰@DÕd[@@n/Áª¿Û«J1pTbT  5ਢ¦* €€€8*1*ˆˆpTQSP@@@Œ•Ä�€D 8ª¨© (  FŽJŒ â@@¢†UÔT#G%Fq  QCŽ*jªŠ€€ˆ€££‚8�¨!G5UE@@ÄÀQ‰QA€€@Ô€£Ššª€"  bà¨Ä¨ @@ jÀQEMU@1pTbT  5ਢ¦* €€€8*1*ˆˆpTQSP@@@Œ•Ä�€D 8ª¨© (  FŽJŒ â@@¢†UÔT#G%Fq  QCŽ*jªŠ€€ˆ€££‚8�¨!G5UE@@ÄÀQ‰QA€€@Ô€£Ššª€"  bà¨Ä¨ @@ jÀQEMU@1pTbT  5ਢ¦* €€€8*1*ˆˆpTQSP@@@Œ€¿£b�†nƒÁèK=¢8‡¹«¡îÐQ©H   0¹x;*s[AZܼ…K.œ›SfÁY±ÝM%%ûESÚNîß |´Ã6¹€Á�ñ% tT抬ÛÍd×ëzôš}Šªm w4 «ŒÄvjÇÕE1—&K{QÓ¢]7¬ $�€†•£«qK3Qiö¬_•²8c“º\IvV¶³4§µ¦(+3'/'3††Ì¼Š..’°û3cÒžzn!̺ŒÌÌ´˜¼½í®rØö‚Ì´¬Ÿ¼þ·/ }˜µ«¢ ‹““SRãääç•d¥Ñø´¬’v³KŒÃØ^æNO n2ðóÙŽšœ,š«ÎêJ‹�IJ`Ð,Úrj¢ZkqFèë Qh¸3 õY4¨ê=SŸM�²÷Ùh´­‡atšjšL^ÙÂè­NïÊ;h71Zmce®[‚S¤I­à2×3�º–Jî°°ž¿`©tËïÔVs‡…�Î Z.Cn‹N¯ïdªÕÅÕ:·|ª“VM¹ÚäLŠÿ  “”€„kî�!Öùáêݵd!Wœ…ÈUšWÖ§’ªª/¬ÚðïGölÊ�¥¤¦¦°±‹ ™#0u•Ô-‡~J’RÓ“ØøtBN¹$ÐHóÉ·¹[ÙúÔ$B–©ËÊ·”·íXŸ.%7ò UòÚ}GͿʤ‰®]í#d9‰�¿kñâ�[iéC!v~F¹ZMR20²8G  0 ý»Ó>—뺤?IÏ]qÔI]G6o>�÷¸»3…'�€‘ë’;Æz¦•!Dë’?ÿþ‡ ±xÒxäÇ'.%dº3Ñý›Jóo=zXX:æXÔ*ú“¦dämÝš·1CèÝEá@@`òrTq‰s8³Ü.ÇÒ}œ�…ñn�D»6Îà¸vU�Ê—ëNæJĸâÜ—dw? \îÓÑ ­÷EÁbñœÈ–e–6 Ú-Ü�cóÎܪ#žKtúª®®®áP‡p Ìs  “†À�£’,{œN m{èg‡ºÍÆöší[jIþó«ùËôÂlÛ\Ón0ÚÞxiQ<·B&$PÛüy»�þúÊìZìÀš�£QßÓK�׌þJò²�„lûÙîv£ÕÜÕTº¹Šdg¯ñ’#”I�Ù¦Š²ºÖ³-vöœ¤xÚ«K¤ÿ\Áv®Y©TnxéS,¦p#Á'€LR¹7{¯&ßÓëÉVëí΋®Ån¹-½® üeS­Š[`A�ÇrfàA8ã\ÿUnу½§…®¯pe±{m„¥\AåŒ3/CWn(ÊùU¶ê!mQk ', ·ôƒ(+‡ÖW8óã?€€Àä"CÍq»ç'íYDšœìéìX+2<Ç4å-7m²ä¤ð¦…f£Ù!‘&'yä{—ïsæ`ÍVÚk’&…˜Þ';NA@&8Áª?—%Ò¤d?OÔGú®^§Þ"ÙÿÒˆí—$%'� “„º(?}F�IA@&6�¡9ªÀvÄ.~>ÿÅop‹ý@@@`œ øý�³(@@‚¥G,?®�€€@D ÀQE/„ƒ€„KŽ*\‚È  QpTÅ á  á€£ — òƒ€D”UDñB8€€@¸à¨Â%ˆü  %GQ¼  .8ªp "?€€@D ÀQE/„ƒ€„KŽ*\‚È  QpTÅ á  á€£ — òƒ€D”UDñB8€€@¸à¨Â%ˆü  %GQ¼  .8ªp "?€€@D ÀQE/„ƒ€„KŽ*\‚È  QpTÅ á  á€£ — òƒ€D”UDñB8€€@¸à¨Â%ˆü  %GQ¼  .8ªp "?€€@D ÀQE/„ƒ€„KŽ*\‚È  QpTÅ á  á€£ — òƒ€D”UDñB8€€@¸à¨Â%ˆü  %GQ¼  .8ªp "?€€@D ÀQE/„ƒ€„KŽ*\‚È  QpTÅ á  á�„+ùAƈ€ùúY[lJJ,¾•ct2Š4l&µL²pñ4餸UV[wï !1 ã’¥¢•Uv²‡>=zi€Ì\ùÝõ©âúŠn¤x¹sןÖ}ç[ÉnHƶº“Œ�™«Ÿz:#%Üb£%¿£½á qÉ㙫’ÆH£‰Ê3õklkøË•å3— ÏÖþÅ·Ûœ¹è³Ò „‰§ÿl¼°nÁKöþ`;z�Þ ’åß]°v¿/Bíp<Þ¬UÙç‹›i©3?2-Ê«ïìðV š»L‡ ² ßšæn‡Ï8Å@[Õ+Ëçñß óæ™x•¦�yE³úå ñLƒÑìõ…r—Š µiü´ X®ESLõi± ©ÂTæ:5T¨´C±êȦo,.Þ×c*mQS«TaTÇ·‡§˜]#6"õ«UÓ»ZÊýÌtý¢ÙÙ㧵Ÿ“hîkð¹`¯?þ(�çþ¾ú](ò}òãt‚°T(�Í-¶t÷ ØÆÕ»¦øØ\b´‡áµL~l®ÊuSÛm7z´gæ’Ž²€íªïCšËU܆ó—;™ì}:Îø¦­ã÷œ@–+K{QÓ¢]7Ä"õ…ŠÁA[¹‚� ûø*±�Ú±CuÑ1d=š® ŠÄx¯¨ÑŸÜž¢v�ÔˆHÔo|ÂR"Oþôæ‰ß™ìß÷ï§Ë’~¤YúÞÚ©>Ö˜¿´ôe/øã`ÆÑÁu?Çï‹�8²h^Ü¢”Øñm…$i/.üP;SІcùÙR²(1Æ)B"�–²fúýÁäEƒ£²îÏËLK›·ƒæßšIóö[ƒé8|É»M'Ä.R¼ÃP³+/†Y㢽ˆA£ØŽý™1iO=·‡b^—A1Çäímw昞@š¼S�“F-HË*i7»�Ì®ÛÃ3ˆ]ÄÚUQ�嬗œ’£oUºÍôú«_q9ŽÖý»²8f\È)ÙopËw[‹ø i9Eï6Ö’9^ˆžX¯6¾EîyiÁJ¯«7�hË:úëwŒ»D‡ð]¡ûÓi_*¸ï‹ñåLícií¢òŽsë‹Ïˆ`�¿È:óVÍ…_æOŽ9žœÙÛÅre: ½oäñ11'ÿ©¢ßs—X;ÎÿïL.þg‘ÓùË:þεöþS–þ�]NeûÿXtòu7�'lû™'ÓNæ½~ùÃÃ7Ü79edå[õ?H£åê~Tt¹¹–ÌvJwþ·ÝàÂhÏq8Ý·1ÊkïÑ阖JªRá¾zÈ輇¦Æ¨?1�˵›­¶‘èSh|»ºÚ£R¨…]TS¹’êž[Ïè{õšbÚß’«{ý »ý¶JVS]Hõ«latŒV§wÚf©äô'ªz¦S[Í6òÚŽÔ®ÛÄ3 ]&5­ ’MÍÒµTr‡…õ!Ô‚Hý�c©ÎÏU×¶töôè™úì!nzŠ˜(Š5z½¦2Ÿe¹ïMä§?î·Uçð¾pÓÄôµ5žÙJ4ßÓ ýÙ{®t0—Þ¥ƒ~…݇uWÚ™+¯¡\o8›d,ŠcéåÞ5n1#´ÂBµ 2ô7ü˜÷M‹`noªÕž�6mšGØÀÀÀüuÿ¸>59eÕª”{í´‰œŸzÿªUt±ÂhB ù¤}ÄåJ’RÓ“ØøtBNŧ ÛQ¿¥–6‚�ͳŸí¸8#m½’¼úv‡ykr´ ÇHSRSSØØÅ„Ì‘?˜ºJ0npÃBä*Í+ëS I-TÉk÷5ÿ*3nÄvIÖcDy²Ë|òíf:õV¶>•ÖÄ2uùAù–ò¶ëÓ†W·üõ€rdK+ÌÝG;:ÈŒ�ä’ª�9n’ö†�„”«_ÎX,%/ì,w÷K(åôɆ%>ã{S’Rg'±SÛÈ¥3‚ûP’’¸2å–]y†ÌOH[•83éH3¹ pÝ‘GË—ÿ[× §Ò/2¹Ù±ÿJ }~~,Ö~öÚ…qO)ûw½}ͼušä¤õï$áOÿ:'UF¿î7êv\6×Ülâ=Â6Ý/I’¥'ÝŒO¿HN¹bÜ4C/wÊù†ë„Ìú/'.â¾×öí¾Ò÷ÂUÒø9*KÏW¶ßu×Ð\ÈõK—VÌþuTœ.;§¶Ý«céÒ1´�@òWOe¹v±A ]ìv®G�Ý÷eEÅ_¸«ñKóóר-,Ii‹è/{ìc\FQÓ¼µ›#uµ„ñ‰K餽-FiWàzŒ(O»¬gZB^t/õžÿÄ4pɼ q`9ÆŠœy[ªˆ";7mnüåSô€ãÆŃKœÅH?DˆfØBh‚™Äñ•þVÎ*廬^ä¿/·B»GC)i&4 ™úôƒîÛ�³d�o—¦™¾4þÞÕ.ÅýÏ5ƒVÖq¹•è ºZZI¼BI~#jy‚Oì è½r¹¼4ÅL÷÷bú%ä Ÿ‚� M –.ük‹×¿rpýˆÅðkÄ�‘¤O|kUp]ËM¹TQWË-x”åµ��³�4Ÿéõ±dÃ+¥›BX�ì“ë6�&Äú%TÄë9g íŠÔò)ÿ•+YýØtB®üþ}›•½Þô&7,I;v‚Œ.G(ˆñ:Œ–™FC§£ÕZß„ô¶¨8u••^sxc¨´X¹Z~ö\ˆI¥(fÑ©³�ëî¥&FůGpf‘ç׎ï/F„ÃT«â&þi óR|N~ù@9ã”ÂЕ! ÷äÿ(ìºm<ýí´÷´¸~øF­UëB¼‡üê7€K½›$];‘­Z4aaªéäJ.~èîeÊyø‚Oåi»¾çó;*í)ÃÿRÊý_et߇ŽölÍ}ê>÷©G &;îwTéªk&“}¨•±DW"˜˜³ü" nå·Ô¢Ö¹XÇÑY{‚�qÆ{5 h+�»â§è‚‹g*�K6®–)\)ݹκÚÑ•kgª;\ä'òí6»I×ôwT1´Z]ß©¨üh*Ê||g3u`[Ó£mq‚//+}î ™,ir¼ÖÄcÞí²kŒÊu˜�f‡Dšœ4|gÊc²Ø�¸Öj¶²D–ì7!é°ͬ4)Y|ÀZXÒÍ£Y_ýpÍ’Ï~u—×›)„Ip Ö·²Îý‚ë§Ë>2Ý›)è�{‹H¦Ê’¦ oE‡u —�’’ÌîÍ:û› +´ü* *”µXS““|–õŒ{ÀrÍ씤d‰@G{ÅÉÌ-´ˆ©;´+ÿOºhYQî¨ %1 wÐÇσ/„Ù̈�Hˆ.·X‘J¢}<>º˜ÝyÚ8nÒÛ„ÎfJ¥Ã —…€Æò›Ìó{³–k·†6÷‚ÄQ%dÙ[4£DêåM¢~M5‡)/[,/ÇÉ„ÓÎQ£�±&0e’õÆÇšäq$SÇî6‘¬X?ýû+nû£QŒT¼å=*ܘ  w:�ÛîJïô €ý  Á ÀQ烫  ·™Õm®  œUp>wÂUGû…›®š™J7îkèù+]â:&Áhú¬æ’×ÏZÇDl!c¥ÿXÉ ¤j¤å*ñ ýਢ¿ŽÆRCöÚç%'¼¼Û|vûã—è»êăÍò‡ çó:Æè�çL¿|V_Ð+Š«Vìˆôãã*}DrF¡q¤å�B%d�(!G%1NjH];®ì¹èý#oú.U…$>�6î ”|˜øxÉB2%a<1"ýEù8M‘œa(ˆ]Ž´|±2ƒÕĨ§ðµd¯Èl}ì©“ïÒ´®k{:ó˵yú£N±Ó§�fsUÁ‘ÇbZצ}ýëöwiâ÷{´ìØ&š˜ûÓnkºøÍ_¼$ûEÑ×¼ð#¯½{•zïê­ 5'·9åd{»Ãýzæ ò —?ÌÓòå¶>Vpú îw�\`ët› N¸÷ÄOxiO×Ð×EÐ ®�nSæ‘m9¼œÌö·»øÎb>äЛŸ®psÈ9ñ¡{t”“Ÿ£ûu�Ód!ON'± ®çˆ9‹‰FLpT“¡C±A:óQõÊ·vΧS¹øW{–¿W�¼d(£ã£ó~×¹¼dé@•¼ësW|ÌÂ/ݽ5‘¼ÕßpU0ZÈœ/Ú֟ܲêýš÷«˜†ÙœåìŽ#?Þykƒfí'o%²;©qÝtæŠ#O>k&õ+?é]ûÎ:¶tõß÷p¯_¥×�oì-]صýÒÌíºµŸ0KzýÚ ÷Ë&–ÙmÜ^êxH³òýú»ä&ÿÒ×ú÷±L3Û˜šò¾~eéÂë¥÷=@• ÆG\޹ŒyzKÿŒú•uº¥¯ö\Ù>ïÄgNný,Se©Z0ß�§ó²ÿqù9ø @ Lnã93¹IF½uS¤ÎZÀÆÜM ‰ò9kW ~~ã‘'½óÊ‚µ„¬-LÚ]{õ¸™|›{µ¢øÆ}äÚÍ«œµSâîš±hã½4W°`½ò·‘à²üŒR2ãµò¾�¶ð>�½úéÚuKxxÞ­s¶ø4™œ˜t ü4yZ ùýœ{›H Þ[ù÷>­‹*æ •{ƒN+8|ߋܥYn•èOöªm¬:»ïˆý¹ŒØ€|Ä9 œzÛATËv­ŸEQݣ+Ûn>™>•ä9¤¯÷Q=GÄÙ["Î@`R@�jRUç°Æ¸vát�œYæLq½ë‹›Câ7Nôˆò߸ïþ”×ó%��WÄ}I‡þ^knè�¶ãR/ÅÉb÷\˜}°Ÿžg;¾®èùCÕ…½ÛåÏTØùý‚ÈW$¦‹¿õñQÈÄ/ùëOËõØ+›Î¹;Ï‹Îñ¡i|äXû¿¢3JÝÜæ'7¦¹÷¨áúYÀ·Óp_ö|ظ�m:½§îò óMÉìi‰´ƒ4'ðŠA*J–ð·‘àùên;Ûué÷Üp¿‘ lÖwŠé†“¯¢b »LŸíêü˜Ÿs $æúùß%%;ô5ÚYóµ/ÊN:Ó{ôõ= ?¡‹G˜¾üš+Ì׿~£»ŠH”+¼<Œ/q9Ò{6Ò�Ïü¶�í7[?/½ô7"}v�—_}�‹Ë'�8ƒx˜´Fôl:i)Ü9†Éf=S›¤Qžýá6ºqbÒ;C=!÷í¸;�ãg_\×wÚ GÙñ$=P-;ôÊÜ8“íÀ³Æ=.hÓ²µÿÅ='$ÊqÊÊ]Y¢<±}IÝsŽRBj§Lão»Ûxú±>z¼Æ™O>Sµ•? $ñÂ_joJ×]ÈÛy‰O7³Ä³/"Ý<Ô?ÐßéLúž=ÁYDÈã-©?â&äø Ê'€œ…©çÛóäGª¸¬Ó²uk¾?ôš1žÎ"üÿ�?BÎþr“…Þž>Yjrœí¸Åš´ÿ—4mfH%ßê7ؤӒe~}xë¿á¤$I*¼DþÍ~£Ý&�š$‹ÝcV…ö¡Iï7Ýs¯‘µÉ¤~{†d�'‘ÃLIL‰K‘ƒ'_ˆA8„(É@`âÝW}âÛ Â$0Eš4m¨ÿ0¼°)3“¥â.MF½—þ ò§ÎLž*.Ê_ŒxÌ-Òç¸NWB$KGb‚¸,ê`“ůŒIlc"B@`">ÄN}¡#„K@²8ñ»/&ÎW òƒŒ ý�i”  0*èQ� 2�€Œ8ªñ"�r@@FEŽjTØ�éÎ"à0^;k£�Nî,r°Æ‚ÕXPœ 2Œ¦�+ôïí׿WwùÂø«<‘7t|vò;óŽ~è~YûøÃC‰ pG€£ºƒªÿ¢åÓ-—TÏ_Rí6]³E7 ²Qáøk¸Dé3÷l'ìöƒ×àªCˆ8ªˆ¡�>Á©KÔƒ_•ÓßÎÝŽjÝ0ÈF…QÅOšø”z yö|kTie@à!p;Z¬;m”š)Ö'သ�c¾~­ìĶœŸ óÒ@±�ƒmTè�ŽJøòéýW¼^ðÚÕóZfûçëÅ6Nt´ž-Í¢ïwç7xÌ9qÀàzµ¹øÆ‰´Ì 6’¤Lù.¹ò»vÌTù×b@ Âà¨" xˆé€î�×|¢™C¶]i¬ê?ËoSØT±�ƒmTè/iêÂ¥ä´êò)ÁöëË5Ídf%ºq"{ΪÏL©èLýŒn�H®”,<ñ¹3»èƉôR  �¹îš±œ¾ ýº{#g$þƒŒ8ªq€ÝE mxϪy9êd9±Ð 9�=.›ýý¤9¤Ÿn¨H†6B”-ÊXôóÊi\ÊaÞÄÅm øÀÃIܶÎ7Âry¸�W¦%ÜM¿‘ã¬VÍòb¤¤G’îaÌm,a÷~½6óä„ôÒ~\þÜtgÑž�3f­]¿¤`#·™áÌ�÷©sfÍ5XOœuÄ?B_óÎëÏíÞ8qñ¬'鯉„¥'rÑ‚� ×n¼÷ç½ôᓜnµR ãJ`˜f\uAa·ƒ€sÀÝoûæ646sò[ØðžûÝ!ΧŽj˜�?—UþÒ C vŰ|özÒ§9~mÕÁÒ<ÐÔaM}‹�úD÷{öèÆ‰¾{*+Ž(¶°D!}�³v³õ&ñÞ1èÆ‰â²5G¾ñ¬¤Ô~ß“pHÑYÑÐjrÀ÷nr×oèÖ�`À¶ÎMë®.*O~àêÕ=¯:Hå\ºn;Jƒ46I:´ÐЭd��Å7*”f­ýÊ>UŠo‹› >A`\ ¸‡íǵP6± Ü=w³*žî«ýO¢¨_ÙüÂ,¯eÜQoÛh6N”ÀKE}½BÁILC“¸ra€LèQM†Z„  0‰ ÀQMâÊ…i  0ÀQM†Z„  0‰ ÀQ¬\‡¹«¡î�1øoYæÍc[]ÅÞ½û÷î­kå~ûãFªOÈéí 5Mcö ;‡¹½fCøÜBÖ߇S¸§C[ƒÿpå"?€Àh ü«£ŠuQ%‡IEND®B`‚yargs-cliui-2737977/test/000077500000000000000000000000001476570515600151545ustar00rootroot00000000000000yargs-cliui-2737977/test/cliui.mjs000066400000000000000000000315251476570515600170020ustar00rootroot00000000000000import chalk from 'chalk' import cliui from '../index.mjs' import stripAnsi from 'strip-ansi' import { should } from 'chai' /* global describe, it */ should() // Force chalk to enable color, if it's disabled the test fails. process.env.FORCE_COLOR = 1 describe('cliui', () => { describe('resetOutput', () => { it('should set lines to empty', () => { const ui = cliui() ui.div('i am a value that would be in a line') ui.resetOutput() ui.toString().length.should.be.equal(0) }) }) describe('div', () => { it("wraps text at 'width' if a single column is given", () => { const ui = cliui({ width: 10 }) ui.div('i am a string that should be wrapped') ui.toString().split('\n').forEach(row => { row.length.should.be.lte(10) }) }) it('evenly divides text across columns if multiple columns are given', () => { const ui = cliui({ width: 40 }) ui.div( { text: 'i am a string that should be wrapped', width: 15 }, 'i am a second string that should be wrapped', 'i am a third string that should be wrapped' ) // total width of all columns is <= // the width cliui is initialized with. ui.toString().split('\n').forEach(row => { row.length.should.be.lte(40) }) // it should wrap each column appropriately. const expected = [ 'i am a string i am a i am a third', 'that should be second string that', 'wrapped string that should be', ' should be wrapped', ' wrapped' ] ui.toString().split('\n').should.eql(expected) }) it('allows for a blank row to be appended', () => { const ui = cliui({ width: 40 }) ui.div() // it should wrap each column appropriately. const expected = [''] ui.toString().split('\n').should.eql(expected) }) }) describe('_columnWidths', () => { it('uses same width for each column by default', () => { const ui = cliui({ width: 40 }) const widths = ui.columnWidths([{}, {}, {}]) widths[0].should.equal(13) widths[1].should.equal(13) widths[2].should.equal(13) }) it('divides width over remaining columns if first column has width specified', () => { const ui = cliui({ width: 40 }) const widths = ui.columnWidths([{ width: 20 }, {}, {}]) widths[0].should.equal(20) widths[1].should.equal(10) widths[2].should.equal(10) }) it('divides width over remaining columns if middle column has width specified', () => { const ui = cliui({ width: 40 }) const widths = ui.columnWidths([{}, { width: 10 }, {}]) widths[0].should.equal(15) widths[1].should.equal(10) widths[2].should.equal(15) }) it('keeps track of remaining width if multiple columns have width specified', () => { const ui = cliui({ width: 40 }) const widths = ui.columnWidths([{ width: 20 }, { width: 12 }, {}]) widths[0].should.equal(20) widths[1].should.equal(12) widths[2].should.equal(8) }) it('uses a sane default if impossible widths are specified', () => { const ui = cliui({ width: 40 }) const widths = ui.columnWidths([{ width: 30 }, { width: 30 }, { padding: [0, 2, 0, 1] }]) widths[0].should.equal(30) widths[1].should.equal(30) widths[2].should.equal(4) }) }) describe('alignment', () => { it('allows a column to be right aligned', () => { const ui = cliui({ width: 40 }) ui.div( 'i am a string', { text: 'i am a second string', align: 'right' }, 'i am a third string that should be wrapped' ) // it should right-align the second column. const expected = [ 'i am a stringi am a secondi am a third', ' stringstring that', ' should be', ' wrapped' ] ui.toString().split('\n').should.eql(expected) }) it('allows a column to be center aligned', () => { const ui = cliui({ width: 60 }) ui.div( 'i am a string', { text: 'i am a second string', align: 'center', padding: [0, 2, 0, 2] }, 'i am a third string that should be wrapped' ) // it should right-align the second column. const expected = [ 'i am a string i am a second i am a third string', ' string that should be', ' wrapped' ] ui.toString().split('\n').should.eql(expected) }) }) describe('padding', () => { it('handles left/right padding', () => { const ui = cliui({ width: 40 }) ui.div( { text: 'i have padding on my left', padding: [0, 0, 0, 4] }, { text: 'i have padding on my right', padding: [0, 2, 0, 0], align: 'center' }, { text: 'i have no padding', padding: [0, 0, 0, 0] } ) // it should add left/right padding to columns. const expected = [ ' i have i have i have no', ' padding padding on padding', ' on my my right', ' left' ] ui.toString().split('\n').should.eql(expected) }) it('handles top/bottom padding', () => { const ui = cliui({ width: 40 }) ui.div( 'i am a string', { text: 'i am a second string', padding: [2, 0, 0, 0] }, { text: 'i am a third string that should be wrapped', padding: [0, 0, 1, 0] } ) // it should add top/bottom padding to second // and third columns. const expected = [ 'i am a string i am a third', ' string that', ' i am a secondshould be', ' string wrapped', '' ] ui.toString().split('\n').should.eql(expected) }) it('preserves leading whitespace as padding', () => { const ui = cliui() ui.div(' LEADING WHITESPACE') ui.div('\u001b[34m with ansi\u001b[39m') const expected = [ ' LEADING WHITESPACE', ' with ansi' ] ui.toString().split('\n').map(l => stripAnsi(l)).should.eql(expected) }) }) describe('border', () => { it('allows a border to be placed around a div', () => { const ui = cliui({ width: 40 }) ui.div( { text: 'i am a first string', padding: [0, 0, 0, 0], border: true }, { text: 'i am a second string', padding: [1, 0, 0, 0], border: true } ) const expected = [ '.------------------.', '| i am a first |.------------------.', '| string || i am a second |', "'------------------'| string |", " '------------------'" ] ui.toString().split('\n').should.eql(expected) }) }) describe('wrap', () => { it('allows wordwrap to be disabled', () => { const ui = cliui({ wrap: false }) ui.div( { text: 'i am a string', padding: [0, 1, 0, 0] }, { text: 'i am a second string', padding: [0, 2, 0, 0] }, { text: 'i am a third string that should not be wrapped', padding: [0, 0, 0, 2] } ) ui.toString().should.equal('i am a string i am a second string i am a third string that should not be wrapped') }) }) describe('span', () => { it('appends the next row to the end of the prior row if it fits', () => { const ui = cliui({ width: 40 }) ui.span( { text: 'i am a string that will be wrapped', width: 30 } ) ui.div( { text: ' [required] [default: 99]', align: 'right' } ) const expected = [ 'i am a string that will be', 'wrapped [required] [default: 99]' ] ui.toString().split('\n').should.eql(expected) }) it('does not append the string if it does not fit on the prior row', () => { const ui = cliui({ width: 40 }) ui.span( { text: 'i am a string that will be wrapped', width: 30 } ) ui.div( { text: 'i am a second row', align: 'left' } ) const expected = [ 'i am a string that will be', 'wrapped', 'i am a second row' ] ui.toString().split('\n').should.eql(expected) }) it('always appends text to prior span if wrap is disabled', () => { const ui = cliui({ wrap: false, width: 40 }) ui.span( { text: 'i am a string that will be wrapped', width: 30 } ) ui.div( { text: 'i am a second row', align: 'left', padding: [0, 0, 0, 3] } ) ui.div('a third line') const expected = [ 'i am a string that will be wrapped i am a second row', 'a third line' ] ui.toString().split('\n').should.eql(expected) }) it('appends to prior line appropriately when strings contain ansi escape codes', () => { const ui = cliui({ width: 40 }) ui.span( { text: chalk.green('i am a string that will be wrapped'), width: 30 } ) ui.div( { text: chalk.blue(' [required] [default: 99]'), align: 'right' } ) const expected = [ 'i am a string that will be', 'wrapped [required] [default: 99]' ] ui.toString().split('\n').map(l => stripAnsi(l)).should.eql(expected) }) }) describe('layoutDSL', () => { it('turns tab into multiple columns', () => { const ui = cliui({ width: 60 }) ui.div( ' \tmy awesome regex\n \tanother row\t a third column' ) const expected = [ ' my awesome regex', ' another row a third column' ] ui.toString().split('\n').should.eql(expected) }) it('turns newline into multiple rows', () => { const ui = cliui({ width: 40 }) ui.div( 'Usage: $0\n \t my awesome regex\n \t my awesome glob\t [required]' ) const expected = [ 'Usage: $0', ' my awesome regex', ' my awesome [required]', ' glob' ] ui.toString().split('\n').should.eql(expected) }) it('aligns rows appropriately when they contain ansi escape codes', () => { const ui = cliui({ width: 40 }) ui.div( ' \t ' + chalk.red('my awesome regex') + '\t [regex]\n ' + chalk.blue('') + '\t my awesome glob\t [required]' ) const expected = [ ' my awesome [regex]', ' regex', ' my awesome [required]', ' glob' ] ui.toString().split('\n').map(l => stripAnsi(l)).should.eql(expected) }) it('ignores ansi escape codes when measuring padding', () => { // Forcefully enable color-codes for this test const { enabled, level } = chalk chalk.enabled = true chalk.level = 1 const ui = cliui({ width: 25 }) // using figlet font 'Shadow' rendering of text 'true' here ui.div( chalk.blue(' | \n __| __| | | _ \\ \n | | | | __/ \n \\__| _| \\__,_| \\___| \n ') ) // relevant part is first line - leading whitespace should be preserved as left padding const expected = [ ' |', ' __| __| | | _ \\', ' | | | | __/', ' \\__| _| \\__,_| \\___|', ' ' ] ui.toString().split('\n').map(l => stripAnsi(l)).should.eql(expected) chalk.enabled = enabled chalk.level = level }) it('correctly handles lack of ansi escape codes when measuring padding', () => { const ui = cliui({ width: 25 }) // using figlet font 'Shadow' rendering of text 'true' here ui.div( ' | \n __| __| | | _ \\ \n | | | | __/ \n \\__| _| \\__,_| \\___| \n ' ) // The difference const expected = [ ' |', ' __| __| | | _ \\', ' | | | | __/', ' \\__| _| \\__,_| \\___|', '' ] ui.toString().split('\n').map(l => stripAnsi(l)).should.eql(expected) }) it('does not apply DSL if wrap is false', () => { const ui = cliui({ width: 40, wrap: false }) ui.div( 'Usage: $0\ttwo\tthree' ) ui.toString().should.eql('Usage: $0\ttwo\tthree') }) }) }) yargs-cliui-2737977/test/deno/000077500000000000000000000000001476570515600161015ustar00rootroot00000000000000yargs-cliui-2737977/test/deno/cliui-test.ts000066400000000000000000000027111476570515600205340ustar00rootroot00000000000000/* global Deno */ import { assert, assertEquals } from 'https://deno.land/std/testing/asserts.ts' import cliui from '../../deno.ts' // Just run a couple of the tests as a light check working from the Deno runtime. Deno.test("wraps text at 'width' if a single column is given", () => { const ui = cliui({ width: 10 }) ui.div('i am a string that should be wrapped') ui.toString().split('\n').forEach((row: string) => { assert(row.length <= 10) }) }) Deno.test('evenly divides text across columns if multiple columns are given', () => { const ui = cliui({ width: 40 }) ui.div( { text: 'i am a string that should be wrapped', width: 15 }, 'i am a second string that should be wrapped', 'i am a third string that should be wrapped' ) // total width of all columns is <= // the width cliui is initialized with. ui.toString().split('\n').forEach((row: string) => { assert(row.length <= 40) }) // it should wrap each column appropriately. // TODO: we should flesh out the Deno and ESM implementation // such that it spreads words out over multiple columns appropriately: const expected = [ 'i am a string i am a i am a third', 'that should be second string that', 'wrapped string that should be', ' should be wrapped', ' wrapped' ] ui.toString().split('\n').forEach((line: string, i: number) => { assertEquals(line, expected[i]) }) }) yargs-cliui-2737977/tsconfig.json000066400000000000000000000004651476570515600167110ustar00rootroot00000000000000{ "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { "outDir": "build", "rootDir": ".", "sourceMap": false, "target": "es2017", "moduleResolution": "node", "module": "es2015" }, "include": [ "lib/**/*.ts" ], "exclude": [ "lib/cjs.ts" ] }yargs-cliui-2737977/tsconfig.test.json000066400000000000000000000001241476570515600176570ustar00rootroot00000000000000{ "extends": "./tsconfig.json", "compilerOptions": { "sourceMap": true } }