Skip to content

Inconsistent format of examples in help text #10449

Description

@iamazeem

Describe the bug

The format of examples is not consistent.

Here are a few examples:

Example: heredoc.Doc(`
# Get a trusted_root.jsonl for both Sigstore Public Good and GitHub's instance
gh attestation trusted-root

Example: heredoc.Doc(`
$ gh auth refresh --scopes write:org,read:public_key
# => open a browser to add write:org and read:public_key scopes
$ gh auth refresh
# => open a browser to ensure your authentication credentials have the correct minimum scopes

cli/pkg/cmd/api/api.go

Lines 126 to 133 in b642da2

Example: heredoc.Doc(`
# list releases in the current repository
$ gh api repos/{owner}/{repo}/releases
# post an issue comment
$ gh api repos/{owner}/{repo}/issues/123/comments -f body='Hi from CLI'
# post nested parameter read from a file

Example: heredoc.Doc(`
# List caches for current repository
$ gh cache list

Affected version

$ gh --version 
gh version 2.67.0 (2025-02-11)
https://github.com/cli/cli/releases/tag/v2.67.0

Steps to reproduce the behavior

Run commands from above examples with --help flag.

Expected vs actual behavior

A consistent format should be followed across all commands.

Suggested format:

# Description (Sentence case)
$ gh ...

Logs

N/A

Activity

  1. williammartin commented on Feb 17, 2025

    @williammartin
    Member

    Makes sense to me, thanks for your diligence.

    Acceptance Criteria

    When I provide a --help flag to any command
    Then the examples section takes the format:

    # Description (Sentence case)
    $ gh ...
    
  2. added
    priority-3Affects a small number of users or is largely cosmetic
    on Feb 17, 2025
  3. williammartin commented on Feb 17, 2025

    @williammartin
    Member

    I wonder if we could add some linting rules to golangci-lint for this.

  4. iamazeem commented on Feb 18, 2025

    @iamazeem
    ContributorAuthor

    I wonder if we could add some linting rules to golangci-lint for this.

    Checked the supported golangci-lint linters and none seem to support such cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions welcomepriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions