CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
README.md72 linesDownload Raw Back to cli-width
1# cli-width2 3Get stdout window width, with four fallbacks, `tty`, `output.columns`, a custom environment variable and then a default.4 5[![npm version](https://badge.fury.io/js/cli-width.svg)](http://badge.fury.io/js/cli-width)6[![Build Status](https://travis-ci.org/knownasilya/cli-width.svg)](https://travis-ci.org/knownasilya/cli-width)7[![Coverage Status](https://coveralls.io/repos/knownasilya/cli-width/badge.svg?branch=master&service=github)](https://coveralls.io/github/knownasilya/cli-width?branch=master)8 9Tested against Node v12 to v20.10Includes TypeScript types.11 12## Usage13 14```15npm install --save cli-width16```17 18```js19const cliWidth = require('cli-width');20 21cliWidth(); // maybe 204 :)22```23 24You can also set the `CLI_WIDTH` environment variable.25 26If none of the methods are supported, and the environment variable isn't set,27the default width value is going to be `0`, that can be changed using the configurable `options`.28 29## API30 31### cliWidth([options])32 33`cliWidth` can be configured using an `options` parameter, the possible properties are:34 35- **defaultWidth**\<number\> Defines a default value to be used if none of the methods are available, defaults to `0`36- **output**\<object\> A stream to be used to read width values from, defaults to `process.stdout`37- **tty**\<object\> TTY module to try to read width from as a fallback, defaults to `require('tty')`38 39### Examples40 41Defining both a default width value and a stream output to try to read from:42 43```js44const cliWidth = require('cli-width');45const ttys = require('ttys');46 47cliWidth({48  defaultWidth: 80,49  output: ttys.output,50});51```52 53Defines a different tty module to read width from:54 55```js56const cliWidth = require('cli-width');57const ttys = require('ttys');58 59cliWidth({60  tty: ttys,61});62```63 64## Tests65 66```bash67npm install68npm test69```70 71Coverage can be generated with `npm run coverage`.72 
basant307/AI_Governance_Project · CoolFace