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

Target Node 16 #235

Merged
merged 7 commits into from
Mar 30, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor(help): use template literals
  • Loading branch information
tommy-mitchell committed Mar 30, 2023

Verified

This commit was signed with the committer’s verified signature.
pawanjay176 Pawan Dhananjay
commit 50c96a5052198ff6cd52bac2af62fa0dd304268f
14 changes: 10 additions & 4 deletions source/index.js
Original file line number Diff line number Diff line change
@@ -12,10 +12,16 @@ import {validate, checkUnknownFlags, checkMissingRequiredFlags} from './validate
const buildResult = (options, parserOptions) => {
const {pkg: package_} = options;
const argv = parseArguments(options.argv, parserOptions);
let help = trimNewlines((options.help || '').replace(/\t+\n*$/, ''));
let help = '';

if (help.includes('\n')) {
help = redent(help, 2);
if (options.help) {
help = trimNewlines((options.help || '').replace(/\t+\n*$/, ''));

if (help.includes('\n')) {
help = redent(help, 2);
}

help = `\n${help}`;
}

normalizePackageData(package_);
@@ -26,7 +32,7 @@ const buildResult = (options, parserOptions) => {
}

description &&= help ? `\n ${description}\n` : `\n${description}`;
help = (description || '') + (help ? `\n${help}\n` : '\n');
help = `${description || ''}${help}\n`;

const showHelp = code => {
console.log(help);