diff --git a/pkg/cmd/root/help_topic.go b/pkg/cmd/root/help_topic.go index 05798894b..c2c6ce0ac 100644 --- a/pkg/cmd/root/help_topic.go +++ b/pkg/cmd/root/help_topic.go @@ -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 { diff --git a/pkg/cmd/root/root.go b/pkg/cmd/root/root.go index 73db4377c..68f60eaa2 100644 --- a/pkg/cmd/root/root.go +++ b/pkg/cmd/root/root.go @@ -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)