Adding documentation for exit codes used by 'gh'
This commit is contained in:
Matthew Runo 2022-08-15 15:20:19 -07:00
parent 49adbe3fe6
commit 9b16d1ecdd
2 changed files with 15 additions and 0 deletions

View file

@ -129,6 +129,20 @@ var HelpTopics = map[string]map[string]string{
'
`),
},
"exit-codes": {
"short": "Exit codes used by gh",
"long": heredoc.Doc(`
gh follows normal conventions regarding exit codes.
- If a command completes successfully, the exit code will be 0
- If a command fails for any reason, the exit code will be 1
NOTE: It is possible that a particular command may have more exit codes, so it is a good
practice to check documentation for the command if you are relying on exit codes to
control some behavior.
`),
},
}
func NewHelpTopic(ios *iostreams.IOStreams, topic string) *cobra.Command {

View file

@ -111,6 +111,7 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) *cobra.Command {
cmd.AddCommand(NewHelpTopic(f.IOStreams, "environment"))
cmd.AddCommand(NewHelpTopic(f.IOStreams, "formatting"))
cmd.AddCommand(NewHelpTopic(f.IOStreams, "mintty"))
cmd.AddCommand(NewHelpTopic(f.IOStreams, "exit-codes"))
referenceCmd := NewHelpTopic(f.IOStreams, "reference")
referenceCmd.SetHelpFunc(referenceHelpFn(f.IOStreams))
cmd.AddCommand(referenceCmd)