Skip to content

Commit 04e6b25

Browse files
vladimyragnivade
authored andcommitted
Format help message 🎨
1 parent 4edc688 commit 04e6b25

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

bin/tldr

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,29 @@ program
3232
.option('-u, --update', 'Update the local cache')
3333
.option('-c, --clear-cache', 'Clear the local cache');
3434

35+
const help = `
36+
Examples:
37+
38+
$ tldr tar
39+
$ tldr du --os=linux
40+
$ tldr --search "create symbolic link to file"
41+
$ tldr --list
42+
$ tldr --list-all
43+
$ tldr --random
44+
$ tldr --random-example
45+
46+
To control the cache:
47+
48+
$ tldr --update
49+
$ tldr --clear-cache
50+
51+
To render a local file (for testing):
52+
53+
$ tldr --render /path/to/file.md
54+
`;
55+
3556
program.on('--help', () => {
36-
console.log('Examples');
37-
console.log('');
38-
console.log(' $ tldr tar');
39-
console.log(' $ tldr du --os=linux');
40-
console.log(' $ tldr --search "create symbolic link to file"');
41-
console.log(' $ tldr --list');
42-
console.log(' $ tldr --list-all');
43-
console.log(' $ tldr --random');
44-
console.log(' $ tldr --random-example');
45-
console.log('');
46-
console.log('To control the cache');
47-
console.log('');
48-
console.log(' $ tldr --update');
49-
console.log(' $ tldr --clear-cache');
50-
console.log('');
51-
console.log('To render a local file (for testing)');
52-
console.log('');
53-
console.log(' $ tldr --render /path/to/file.md');
54-
console.log('');
57+
console.log(help);
5558
});
5659

5760
program.parse(process.argv);

0 commit comments

Comments
 (0)