Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Commit

Permalink
help: Copy the DEFAULT_OPTIONS object rather than directly adding to it
Browse files Browse the repository at this point in the history
This was causing options from previous calls to printUsage() to stick
around and be displayed for subsequent calls.
  • Loading branch information
AtkinsSJ committed Mar 12, 2024
1 parent 03b15d6 commit 57dff3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/puter-shell/coreutils/coreutil_lib/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down

0 comments on commit 57dff3e

Please sign in to comment.