From 57dff3e1d8adbe7381a527cc227f001220094bad Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Tue, 12 Mar 2024 11:03:30 +0000 Subject: [PATCH] help: Copy the DEFAULT_OPTIONS object rather than directly adding to it This was causing options from previous calls to printUsage() to stick around and be displayed for subsequent calls. --- src/puter-shell/coreutils/coreutil_lib/help.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/puter-shell/coreutils/coreutil_lib/help.js b/src/puter-shell/coreutils/coreutil_lib/help.js index 3125ca5..0dbf09a 100644 --- a/src/puter-shell/coreutils/coreutil_lib/help.js +++ b/src/puter-shell/coreutils/coreutil_lib/help.js @@ -29,7 +29,8 @@ export const DEFAULT_OPTIONS = { export const printUsage = async (command, out, vars) => { const { name, usage, description, args } = command; - const options = Object.assign(DEFAULT_OPTIONS, args.options); + const options = Object.create(DEFAULT_OPTIONS); + Object.assign(options, args.options); const heading = text => { out.write(`\x1B[34;1m${text}:\x1B[0m\n`);