Github-cli

From wikinotes
Revision as of 15:38, 24 October 2023 by Will (talk | contribs) (→‎Usage)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

gh is github's official cli client.

Documentation

Locations

~/.config/gh/config.yml configuration

Configuration

config.yml

git_protocol: https
editor:
prompt: enabled
pager:
aliases:
    co: pr checkout

hosts.yml

github.com:
    user: <githubuser>
    oauth_token: <token>
    git_protocol: https

Usage

The interface is planned out in consistent major/minor commands.

major commands

gh pr
gh issue

subcommands

status        # tailored to you  review-requests, mentions, assigned, etc.
list          # general to all

Examples

gh pr list \
  -a @me          `# my prs` \
  --state closed  `# open/closed/all` \
  -w              `# show in webbrowser` \
gh api graphql --paginate -f query='query {repository(owner: "foo_user", name: "foo_repo"){ description }}'