Skip to content

Commit 351d3f5

Browse files
AtkinsSJKernelDeimos
authored andcommitted
tweak(git): List git subcommands in git help with no arguments
1 parent 73d0f5a commit 351d3f5

File tree

1 file changed

+7
-1
lines changed
  • packages/git/src/subcommands

1 file changed

+7
-1
lines changed

packages/git/src/subcommands/help.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ export default {
3838
const { stdout, stderr } = io;
3939
const { options, positionals } = args;
4040

41-
if (options.all) {
41+
const list_subcommands = () => {
4242
stdout(`See 'git help <command>' for more information.\n`);
4343
const max_name_length = Object.keys(subcommands).reduce((max, name) => Math.max(max, name.length), 0);
4444
for (const [name, command] of Object.entries(subcommands)) {
4545
stdout(` ${name} ${' '.repeat(Math.max(max_name_length - name.length, 0))} ${command.description || ''}`);
4646
}
47+
}
48+
49+
if (options.all) {
50+
list_subcommands();
4751
return;
4852
}
4953

@@ -61,5 +65,7 @@ export default {
6165

6266
// No subcommand name, so show general help
6367
stdout(produce_help_string(git_command));
68+
stdout('Available commands:');
69+
list_subcommands();
6470
}
6571
}

0 commit comments

Comments
 (0)