Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap null causes huge indent (using ASCII) #1987

Closed
OsmanAltun opened this issue Jul 16, 2021 · 0 comments · Fixed by #1988
Closed

Wrap null causes huge indent (using ASCII) #1987

OsmanAltun opened this issue Jul 16, 2021 · 0 comments · Fixed by #1988

Comments

@OsmanAltun
Copy link
Contributor

Code:

yargs.usage(
  fs.readFileSync(path.join(__dirname, 'ascii-logo.txt'), 'utf8')
  .split('\n')
  .map(line => chalk`{bold ${line.substring(0, 20)}}{cyan ${line.substring(20)}}`)
  .join('\n')
  .concat('\nsdsad')
)
  .wrap(null)
  .parse();
yargs.showHelp();

result:

                                          .__                               .__       .___
                       ____   ____   ____ |  |   ____   __  _  _____________|  |    __| _/
                     _/ __ \_/ __ \_/ __ \|  |  /  _ \  \ \/ \/ /  _ \_  __ \  |   / __ | 
                     \  ___/\  ___/\  ___/|  |_(  <_> )  \     (  <_> )  | \/  |__/ /_/ | 
                      \___  >\___  >\___  >____/\____/    \/\_/ \____/|__|  |____/\____ | 
                          \/     \/     \/                                             \/ 
                     sdsad

Options:
  --help     Show help  [boolean]
  --version  Show version number  [boolean]

expected:

                     .__                               .__       .___
  ____   ____   ____ |  |   ____   __  _  _____________|  |    __| _/
_/ __ \_/ __ \_/ __ \|  |  /  _ \  \ \/ \/ /  _ \_  __ \  |   / __ | 
\  ___/\  ___/\  ___/|  |_(  <_> )  \     (  <_> )  | \/  |__/ /_/ | 
 \___  >\___  >\___  >____/\____/    \/\_/ \____/|__|  |____/\____ | 
     \/     \/     \/                                             \/ 
sdsad

Options:
  --help     Show help  [boolean]
  --version  Show version number  [boolean]

possible cause?
After some testing I saw that the leading whitespaces in the first line causes this effect.
It might have something to do with cliui lib, because changing the notation of ui.div('string') to ui.div({text: 'string'}) seems to fix this issue. I will open a PR with this change.

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 a pull request may close this issue.

1 participant