gh-cli-for-education / cli

GitHub’s official command line tool
https://cli.github.com
MIT License
0 stars 0 forks source link

Reunión 2024/07/10 #7

Open crguezl opened 2 months ago

crguezl commented 2 months ago
➜  cli git:(feat/gh-owner-core) gh codespace code --help
Open a codespace in Visual Studio Code

USAGE
  gh codespace code [flags]

FLAGS
  -c, --codespace string    Name of the codespace
      --insiders            Use the insiders version of Visual Studio Code
  -R, --repo string         Filter codespace selection by repository name (user/repo)
      --repo-owner string   Filter codespace selection by repository owner (username or org)
  -w, --web                 Use the web version of Visual Studio Code
crguezl commented 2 months ago

The GitHub CLI (gh) uses the -R option in several commands to specify an alternative repository. This allows you to perform operations on repositories other than the one currently set as your default or the one you are working in.

Commands that Use the -R Option

Here are some common gh commands that utilize the -R option:

  1. gh issue: Manage issues for a repository.

    • Example: gh issue list -R owner/repo
  2. gh pr: Manage pull requests for a repository.

    • Example: gh pr list -R owner/repo
  3. gh repo: Manage GitHub repositories.

    • Example: gh repo view -R owner/repo
  4. gh release: Manage releases for a repository.

    • Example: gh release list -R owner/repo
  5. gh workflow: Manage GitHub Actions workflows.

    • Example: gh workflow list -R owner/repo

Examples

Here are some examples demonstrating how to use the -R option:

  1. List Issues in an Alternative Repository:

    gh issue list -R owner/alternative-repo
  2. List Pull Requests in an Alternative Repository:

    gh pr list -R owner/alternative-repo
  3. View Details of an Alternative Repository:

    gh repo view -R owner/alternative-repo
  4. List Releases in an Alternative Repository:

    gh release list -R owner/alternative-repo
  5. List Workflows in an Alternative Repository:

    gh workflow list -R owner/alternative-repo

General Syntax

The general syntax for using the -R option is:

gh <command> <subcommand> -R owner/repo

Summary

The -R option is a versatile feature of the GitHub CLI that allows you to perform various operations on repositories other than the current or default one. It is particularly useful for managing multiple repositories from the command line.