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

Commit

Permalink
help: Wrap more of the command-usage text
Browse files Browse the repository at this point in the history
  • Loading branch information
AtkinsSJ committed Apr 4, 2024
1 parent 855d354 commit 5fc12d1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/puter-shell/coreutils/coreutil_lib/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export const printUsage = async (command, out, vars) => {
const colorOptionArgument = text => {
return `\x1B[91m${text}\x1B[0m`;
};
const wrap = text => {
return wrapText(text, vars.size.cols).join('\n') + '\n';
}

await heading('Usage');
if (!usage) {
Expand All @@ -62,10 +65,7 @@ export const printUsage = async (command, out, vars) => {
}

if (description) {
const wrappedLines = wrapText(description, vars.size.cols);
for (const line of wrappedLines) {
await out.write(`${line}\n`);
}
await out.write(wrap(description));
await out.write(`\n`);
}

Expand Down Expand Up @@ -127,8 +127,7 @@ export const printUsage = async (command, out, vars) => {
if (helpSections) {
for (const [title, contents] of Object.entries(helpSections)) {
await heading(title);
// FIXME: Wrap the text nicely.
await out.write(contents);
await out.write(wrap(contents));
await out.write('\n\n');
}
}
Expand Down

0 comments on commit 5fc12d1

Please sign in to comment.