Skip to content
Merged
Changes from all commits
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
2 changes: 1 addition & 1 deletion demos/node/src/cli/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Notes:
export async function runCli(argv: string[]) {
const { positionals, flags } = parseArgs(argv);
const command = positionals[0];
if (!command || flags.help) {
if (!command || command === 'help' || command === '--help' || flags.help) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this logic is correct, for better readability and maintainability, you could group the help command checks. Using an array for help commands makes it easier to add more aliases in the future.

Suggested change
if (!command || command === 'help' || command === '--help' || flags.help) {
if (!command || ['help', '--help'].includes(command) || flags.help) {

process.stdout.write(helpText.trimStart());
process.stdout.write('\n');
return;
Expand Down