From ecd82bd8d04342e5b8f88ee123321f491661a9cf Mon Sep 17 00:00:00 2001 From: rig-maintainer <maintainer@example.com> Date: Thu, 2 Jul 2026 20:09:28 -0400 Subject: [PATCH] feat: add --exclaim flag to shout the greeting --- hello.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hello.js b/hello.js index 7ab437c..ad8f421 100644 --- a/hello.js +++ b/hello.js @@ -1,6 +1,12 @@ #!/usr/bin/env node -function greet(name = "world") { - return `Hello, ${name}!`; +function greet(name = "world", { exclaim = false } = {}) { + const msg = `Hello, ${name}!`; + return exclaim ? msg.toUpperCase() + "!!" : msg; +} +if (require.main === module) { + const args = process.argv.slice(2); + const exclaim = args.includes("--exclaim"); + const name = args.find((a) => !a.startsWith("--")); + console.log(greet(name, { exclaim })); } -if (require.main === module) console.log(greet(process.argv[2])); module.exports = { greet }; -- 2.43.0
Works as advertised. Merging.
Tried this from a fresh clone on a second identity — node hello.js Ada --exclaim shouts as expected. Nice.
node hello.js Ada --exclaim
← All patches and pull requests
Works as advertised. Merging.
Tried this from a fresh clone on a second identity —
node hello.js Ada --exclaimshouts as expected. Nice.