Skip to content

expose the method yargs.terminalWidth()#165

Merged
bcoe merged 1 commit intomasterfrom
155-fix
May 29, 2015
Merged

expose the method yargs.terminalWidth()#165
bcoe merged 1 commit intomasterfrom
155-fix

Conversation

@bcoe
Copy link
Copy Markdown
Member

@bcoe bcoe commented May 27, 2015

The terminal width is now exposed by yargs.terminalWidth(), this can be used along with wrap() to maximize the width of usage instructions.

fixes #155

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 03bf0d3 on 155-fix into cc3b0e0 on master.

bcoe added a commit that referenced this pull request May 29, 2015
expose the method yargs.terminalWidth()
@bcoe bcoe merged commit 23fcfb7 into master May 29, 2015
@bcoe bcoe deleted the 155-fix branch May 29, 2015 04:23
@nelson6e65
Copy link
Copy Markdown
Contributor

nelson6e65 commented Aug 15, 2022

How can I use this in Typescript ESM?

Getting error:

import yargs, { terminalWidth } from 'yargs';

// SyntaxError: The requested module 'yargs' does not provide an export named 'terminalWidth'
import yargs, { CommandModule } from 'yargs';

yargs(hideBin(process.argv))
  .wrap(yargs.terminalWidth())

// TypeError: yargs.terminalWidth is not a function
@types/yargs@17.0.11
yargs@17.5.1

@nelson6e65
Copy link
Copy Markdown
Contributor

NVM, I solved by using:

const myYargs = yargs(hideBin(process.argv));

myYargs.wrap(myYargs.terminalWidth())

nelson6e65 added a commit to nelson6e65/yargs that referenced this pull request Aug 15, 2022
Add example note of `.wrap()` method usage with `.terminalWidth()`.

Ref: yargs#165 (comment)
bcoe pushed a commit to nelson6e65/yargs that referenced this pull request Nov 3, 2022
Add example note of `.wrap()` method usage with `.terminalWidth()`.

Ref: yargs#165 (comment)

Co-authored-by: Benjamin E. Coe <bencoe@google.com>
bcoe pushed a commit that referenced this pull request Nov 3, 2022
Add example note of `.wrap()` method usage with `.terminalWidth()`.

Ref: #165 (comment)

Co-authored-by: Benjamin E. Coe <bencoe@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrap to window size

3 participants