Repository: cli/cli
File: pkg/cmd/auth/logout/logout.go (Go)

Code before:
	}

	cmd := &cobra.Command{
		Use:   "logout",
		Args:  cobra.ExactArgs(0),
		Short: "Log out of a GitHub account",
		Long: heredoc.Doc(`
			Remove authentication for a GitHub account.

			This command removes the stored authentication configuration
			for an account. The authentication configuration is only
			removed locally.

			This command does not revoke authentication tokens.

			To revoke all authentication tokens generated by the GitHub CLI:

			1. Visit <https://github.com/settings/applications>
			2. Select the "GitHub CLI" application
			3. Select "Revoke Access"
			4. Select "I understand, revoke access"

			Note: this procedure will revoke all authentication tokens ever
			generated by the GitHub CLI across all your devices.

			For more information about revoking OAuth application tokens, see <https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/reviewing-your-authorized-oauth-apps>
		`),
		Example: heredoc.Doc(`
			# Select what host and account to log out of via a prompt
			$ gh auth logout

			# Log out of a specific host and specific account
			$ gh auth logout --hostname enterprise.internal --user monalisa
		`),
		RunE: func(cmd *cobra.Command, args []string) error {
			if runF != nil {
				return runF(opts)
			}

			return logoutRun(opts)
		},
	}

	cmd.Flags().StringVarP(&opts.Hostname, "hostname", "h", "", "The hostname of the GitHub instance to log out of")
	cmd.Flags().StringVarP(&opts.Username, "user", "u", "", "The account to log out of")

	return cmd
}

func logoutRun(opts *LogoutOptions) error {
	hostname := opts.Hostname

Review comment (security):
I'll defer to you, @BagToad, whether starting the URL on its own line is easier to read or not:

```suggestion
			For more information about revoking OAuth application tokens, see:
			<https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/reviewing-your-authorized-oauth-apps>
```

Code after:
	}

	cmd := &cobra.Command{
		Use:   "logout",
		Args:  cobra.ExactArgs(0),
		Short: "Log out of a GitHub account",
		Long: heredoc.Doc(`
			Remove authentication for a GitHub account.

			This command removes the stored authentication configuration
			for an account. The authentication configuration is only
			removed locally.

			This command does not revoke authentication tokens.

			To revoke all authentication tokens generated by the GitHub CLI:

			1. Visit <https://github.com/settings/applications>
			2. Select the "GitHub CLI" application
			3. Select "Revoke Access"
			4. Select "I understand, revoke access"

			Note: this procedure will revoke all authentication tokens ever
			generated by the GitHub CLI across all your devices.

			For more information about revoking OAuth application tokens, see:
			<https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/reviewing-your-authorized-oauth-apps>
		`),
		Example: heredoc.Doc(`
			# Select what host and account to log out of via a prompt
			$ gh auth logout

			# Log out of a specific host and specific account
			$ gh auth logout --hostname enterprise.internal --user monalisa
		`),
		RunE: func(cmd *cobra.Command, args []string) error {
			if runF != nil {
				return runF(opts)
			}

			return logoutRun(opts)
		},
	}

	cmd.Flags().StringVarP(&opts.Hostname, "hostname", "h", "", "The hostname of the GitHub instance to log out of")
	cmd.Flags().StringVarP(&opts.Username, "user", "u", "", "The account to log out of")

	return cmd
}

func logoutRun(opts *LogoutOptions) error {