Skip to content

Commit 4ed5562

Browse files
nasamuffingitster
authored andcommitted
myfirstcontrib: add 'psuh' to command-list.txt
Users can discover commands and their brief usage by running 'git help git' or 'git help -a'; both of these pages list all available commands based on the contents of 'command-list.txt'. That means adding a new command there is an important part of the new command process, and therefore belongs in the new command tutorial. Teach new users how to add their command, and include a brief overview of how to discover which attributes to place on the command in the list. Since 'git psuh' prints some workspace info, doesn't modify anything, and is targeted as a user-facing porcelain command, list it as a 'mainporcelain' and 'info' command. As the usage string is required to generate this documentation, don't add the command to the list until after the usage string is added to the tutorial. Reported-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent efd5444 commit 4ed5562

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Documentation/MyFirstContribution.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,28 @@ you want to pass as a parameter something which would usually be interpreted as
534534
a flag.) `parse_options()` will terminate parsing when it reaches `--` and give
535535
you the rest of the options afterwards, untouched.
536536

537+
Now that you have a usage hint, you can teach Git how to show it in the general
538+
command list shown by `git help git` or `git help -a`, which is generated from
539+
`command-list.txt`. Find the line for 'git-pull' so you can add your 'git-psuh'
540+
line above it in alphabetical order. Now, we can add some attributes about the
541+
command which impacts where it shows up in the aforementioned help commands. The
542+
top of `command-list.txt` shares some information about what each attribute
543+
means; in those help pages, the commands are sorted according to these
544+
attributes. `git psuh` is user-facing, or porcelain - so we will mark it as
545+
"mainporcelain". For "mainporcelain" commands, the comments at the top of
546+
`command-list.txt` indicate we can also optionally add an attribute from another
547+
list; since `git psuh` shows some information about the user's workspace but
548+
doesn't modify anything, let's mark it as "info". Make sure to keep your
549+
attributes in the same style as the rest of `command-list.txt` using spaces to
550+
align and delineate them:
551+
552+
----
553+
git-prune-packed plumbingmanipulators
554+
git-psuh mainporcelain info
555+
git-pull mainporcelain remote
556+
git-push mainporcelain remote
557+
----
558+
537559
Build again. Now, when you run with `-h`, you should see your usage printed and
538560
your command terminated before anything else interesting happens. Great!
539561

0 commit comments

Comments
 (0)