mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 23:28:39 +08:00
tweak(git): List git subcommands in git help
with no arguments
This commit is contained in:
parent
73d0f5a90c
commit
351d3f50ba
@ -38,12 +38,16 @@ export default {
|
||||
const { stdout, stderr } = io;
|
||||
const { options, positionals } = args;
|
||||
|
||||
if (options.all) {
|
||||
const list_subcommands = () => {
|
||||
stdout(`See 'git help <command>' for more information.\n`);
|
||||
const max_name_length = Object.keys(subcommands).reduce((max, name) => Math.max(max, name.length), 0);
|
||||
for (const [name, command] of Object.entries(subcommands)) {
|
||||
stdout(` ${name} ${' '.repeat(Math.max(max_name_length - name.length, 0))} ${command.description || ''}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.all) {
|
||||
list_subcommands();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -61,5 +65,7 @@ export default {
|
||||
|
||||
// No subcommand name, so show general help
|
||||
stdout(produce_help_string(git_command));
|
||||
stdout('Available commands:');
|
||||
list_subcommands();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user