### Verify Go Installation Source: https://github.com/moving33/cli/blob/trunk/docs/source.md Checks if the Go programming language is installed and meets the minimum version requirement (1.25+). If Go is not installed, it provides a link to the official Go website for installation instructions. ```sh go version ``` -------------------------------- ### Build and Install GitHub CLI (Unix-like) Source: https://github.com/moving33/cli/blob/trunk/docs/install_source.md Installs the GitHub CLI on Unix-like systems. By default, it installs to '/usr/local'. Sudo privileges may be required. An option to specify a custom installation prefix is also provided. ```sh # installs to '/usr/local' by default; sudo may be required, or sudo -E for configured go environments $ make install # or, install to a different location $ make install prefix=/path/to/gh ``` -------------------------------- ### Build and Install gh-cli on Unix-like Systems Source: https://github.com/moving33/cli/blob/trunk/docs/source.md Builds and installs the gh-cli from source on Unix-like operating systems. By default, it installs to '/usr/local'. The `prefix` option allows specifying a custom installation directory. `sudo` may be required. ```sh # installs to '/usr/local' by default; sudo may be required, or sudo -E for configured go environments make install # or, install to a different location make install prefix=/path/to/gh ``` -------------------------------- ### Verify Go Installation Source: https://github.com/moving33/cli/blob/trunk/docs/install_source.md Checks if the Go programming language environment is installed and meets the required version (1.25+). If Go is not installed, users are directed to the official Go website for installation instructions. ```sh $ go version ``` -------------------------------- ### Install GitHub CLI with Scoop Source: https://github.com/moving33/cli/blob/trunk/docs/install_windows.md Installs the GitHub CLI using the Scoop package manager. Scoop is a command-line installer for Windows that aims to be simple and reliable. This is a community-maintained installation method. ```pwsh scoop install gh ``` -------------------------------- ### Build gh-cli Binary on Windows Source: https://github.com/moving33/cli/blob/trunk/docs/source.md Builds the `gh.exe` binary on Windows using the provided Go script. Unlike Unix-like systems, there is no separate install step available on Windows. ```pwsh go run script\build.go ``` -------------------------------- ### Install go-version Library Source: https://github.com/moving33/cli/blob/trunk/third-party/github.com/hashicorp/go-version/README.md Installs the go-version library using the standard Go package management command. ```bash go get github.com/hashicorp/go-version ``` -------------------------------- ### Install GitHub CLI on Funtoo Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Install the GitHub CLI package on Funtoo Linux using the emerge command. This installs the 'github-cli' package from the Funtoo portage tree. ```bash emerge -av github-cli ``` -------------------------------- ### Install GitHub CLI on Fedora/CentOS/RHEL with DNF5 Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Installs the GitHub CLI on systems using DNF5. It installs the DNF5 plugins, adds the GitHub CLI repository configuration, and then installs the 'gh' package. ```bash sudo dnf install dnf5-plugins sudo dnf config-manager addrepo --from-repofile=https://cli.github.com/packages/rpm/gh-cli.repo sudo dnf install gh --repo gh-cli ``` -------------------------------- ### Build GitHub CLI Binary (Windows) Source: https://github.com/moving33/cli/blob/trunk/docs/install_source.md Builds the GitHub CLI executable (`bin\gh.exe`) on Windows using the provided Go build script. Unlike Unix-like systems, there is no separate installation step after building. ```pwsh # build the `bin\gh.exe` binary > go run script\build.go ``` -------------------------------- ### Combine Binaries and Build macOS Installer Packages Source: https://github.com/moving33/cli/blob/trunk/docs/release-process-deep-dive.md Illustrates the utilities used by './script/pkgmacos' to create a macOS '.pkg' installer. It combines 'arm64' and 'amd64' binaries using 'lipo', builds a component package with 'pkgbuild', and creates a final product archive using 'productbuild'. ```bash # Example placeholder for lipo, pkgbuild, and productbuild commands # Actual implementation details are within the script itself. lipo -create arm64_binary amd64_binary -output universal_binary pkgbuild --identifier com.github.cli.pkg --install-location /usr/local/bin --component universal_binary /tmp/gh.pkg productbuild --component /tmp/gh.pkg --sign "Developer ID Installer: GitHub LLC" --license LICENSE --distribution build/macOS/distribution.xml gh-cli.pkg ``` -------------------------------- ### Install GitHub CLI on Debian/Ubuntu Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Installs the GitHub CLI on Debian-based systems like Ubuntu. It first ensures wget is installed, then downloads and adds the GitHub CLI GPG key and repository configuration, and finally installs the 'gh' package using apt. ```bash (type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \ && sudo mkdir -p -m 755 /etc/apt/keyrings \ && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \ && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ && sudo mkdir -p -m 755 /etc/apt/sources.list.d \ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ && sudo apt update \ && sudo apt install gh -y ``` -------------------------------- ### Install GitHub CLI with Webi Source: https://github.com/moving33/cli/blob/trunk/docs/install_windows.md Installs the GitHub CLI using Webi, a tool designed for effortless installation of developer tools. This method uses a simple curl command and executes a script to install the CLI without requiring a package manager or administrative privileges. It's a community-supported approach. ```shell curl -sS https://webi.sh/gh | sh ``` -------------------------------- ### Test Build System Locally - script/release --local Source: https://github.com/moving33/cli/blob/trunk/docs/releasing.md This command allows for local testing of the release build system without creating official release artifacts. It requires GoReleaser to be installed (`brew install goreleaser`). Built products will be found in the `dist/` directory. ```shell script/release --local ``` -------------------------------- ### Install GitHub CLI on Nix/NixOS Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Install the GitHub CLI package on Nix or NixOS systems using the nix-env command. This command installs the 'gh' package from the NixOS channels. ```bash nix-env -iA nixos.gh ``` -------------------------------- ### Install GitHub CLI with WinGet Source: https://github.com/moving33/cli/blob/trunk/docs/install_windows.md Installs the GitHub CLI using the WinGet package manager. This is the officially recommended method for Windows. WinGet is a command-line tool for managing applications on Windows. After installation, a new terminal window may be required for PATH changes to take effect. ```pwsh winget install --id GitHub.cli ``` -------------------------------- ### Install GitHub CLI on openSUSE/SUSE Linux (zypper) Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Installs the GitHub CLI on openSUSE/SUSE Linux using zypper. It adds the GitHub CLI repository, refreshes the repositories, and then installs the 'gh' package. ```bash sudo zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo sudo zypper ref sudo zypper install gh ``` -------------------------------- ### Build MSI Installers with MSBuild Source: https://github.com/moving33/cli/blob/trunk/docs/release-process-deep-dive.md Builds MSI installers by wrapping GoReleaser-generated zip archives using MSBuild. It requires MSBuild.exe and references specific build configuration files in the repository. Outputs include MSI installers for different architectures. ```pwsh "${MSBUILD_PATH}\MSBuild.exe" ./build/windows/gh.wixproj -p:SourceDir="$source_dir" -p:OutputPath="$PWD/dist" -p:OutputName="$MSI_NAME" -p:ProductVersion="${MSI_VERSION#v}" -p:Platform="$platform" ``` -------------------------------- ### Install GitHub CLI on Fedora/CentOS/RHEL with DNF4 Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Installs the GitHub CLI on systems using DNF4. It ensures the 'config-manager' command is available, adds the GitHub CLI repository, and then installs the 'gh' package. ```bash sudo dnf install 'dnf-command(config-manager)' sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo sudo dnf install gh --repo gh-cli ``` -------------------------------- ### Install GitHub CLI on MidnightBSD Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Install the GitHub CLI port on MidnightBSD systems. This can be done by manually compiling the port or using the mport package manager. ```bash cd /usr/mports/devel/gh/ && make install clean ``` ```bash mport install gh ``` -------------------------------- ### Install GitHub CLI with Flox Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Install the GitHub CLI using the Flox package manager. Flox is a virtual environment and package manager that simplifies dependency management. ```shell flox install gh ``` -------------------------------- ### Install GoReleaser - Homebrew Source: https://github.com/moving33/cli/blob/trunk/docs/releasing.md This command installs the GoReleaser tool, which is a prerequisite for testing the release build system locally. GoReleaser is used to automate the release process. ```shell brew install goreleaser ``` -------------------------------- ### Bash GitHub CLI API Access Examples Source: https://context7.com/moving33/cli/llms.txt Provides examples of using the GitHub CLI ('gh api') to interact with the GitHub REST and GraphQL APIs. Commands demonstrate listing releases, creating issue comments, performing GraphQL queries with variables, and handling POST requests with field expansion and file uploads. It also shows how to paginate results and filter output with 'jq'. ```bash # List releases in current repository gh api repos/{owner}/{repo}/releases # Create an issue comment gh api repos/{owner}/{repo}/issues/123/comments \ -f body='Thanks for reporting this issue!' # GraphQL query with variables gh api graphql -f query=' query($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { issues(first: 10, states: OPEN) { nodes { number title author { login } } } } }' -f owner=cli -f repo=cli # POST with magic field conversion gh api repos/{owner}/{repo}/issues \ -f title='Bug report' \ -f body='Description here' \ -F labels='["bug","priority"]' \ -F assignees='["username"]' # Read field from file gh api gists -F 'files[script.sh][content]=@script.sh' # Paginate through all results gh api --paginate repos/{owner}/{repo}/issues # Filter with jq gh api repos/{owner}/{repo}/issues | jq '.[] | {number, title}' ``` -------------------------------- ### Build MSI Installers (Bash) Source: https://github.com/moving33/cli/blob/trunk/docs/release-process-deep-dive.md Iterates through the generated zip files in the `dist` directory to construct Windows Installer (MSI) packages. It dynamically determines the platform (x86, x64, arm64) and version for each MSI using MSBuild. ```yaml - name: Build MSI shell: bash env: MSBUILD_PATH: ${{ steps.setupmsbuild.outputs.msbuildPath }} run: | for ZIP_FILE in dist/gh_*_windows_*.zip; do MSI_NAME="$(basename "$ZIP_FILE" ".zip")" MSI_VERSION="$(cut -d_ -f2 <<<"$MSI_NAME" | cut -d- -f1)" case "$MSI_NAME" in *_386 ) source_dir="$PWD/dist/windows_windows_386" platform="x86" ;; *_amd64 ) source_dir="$PWD/dist/windows_windows_amd64_v1" platform="x64" ;; *_arm64 ) source_dir="$PWD/dist/windows_windows_arm64" platform="arm64" ;; * ) printf "unsupported architecture: %s\n" "$MSI_NAME" >&2 exit 1 ;; esac "${MSBUILD_PATH}\MSBuild.exe" ./build/windows/gh.wixproj -p:SourceDir="$source_dir" -p:OutputPath="$PWD/dist" -p:OutputName="$MSI_NAME" -p:ProductVersion="${MSI_VERSION#v}" -p:Platform="$platform" done ``` -------------------------------- ### Build macOS Artifacts with GoReleaser and Package Installers Source: https://github.com/moving33/cli/blob/trunk/docs/release-process-deep-dive.md This snippet details the process of building macOS artifacts using GoReleaser for executables and zip archives, and then creating a universal macOS .pkg installer. It involves executing specific script commands for releasing and packaging. ```shell script/release --local "$TAG_NAME" --platform macos script/pkgmacos "$TAG_NAME" ``` -------------------------------- ### Clone gh-cli Repository Source: https://github.com/moving33/cli/blob/trunk/docs/source.md Clones the gh-cli repository from GitHub and navigates into the newly created directory. This is the first step in building the CLI from source. ```sh git clone https://github.com/cli/cli.git gh-cli cd gh-cli ``` -------------------------------- ### Upgrade All Packages on Arch Linux Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Upgrade all installed packages on Arch Linux, including the GitHub CLI, using pacman. This ensures all system packages are up-to-date. ```bash sudo pacman -Syu ``` -------------------------------- ### Build macOS Release Artifacts with GitHub Actions Source: https://github.com/moving33/cli/blob/trunk/docs/release-process-deep-dive.md This workflow builds release binaries for macOS, including .tar.gz and .zip archives, and .pkg installers. It handles GoReleaser installation, code signing, and notarization for production environments. Artifacts are uploaded upon successful completion. ```yaml macos: needs: validate-tag-name runs-on: macos-latest environment: ${{ inputs.environment }} if: contains(inputs.platforms, 'macos') steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: 'go.mod' - name: Configure macOS signing if: inputs.environment == 'production' env: APPLE_DEVELOPER_ID: ${{ vars.APPLE_DEVELOPER_ID }} APPLE_APPLICATION_CERT: ${{ secrets.APPLE_APPLICATION_CERT }} APPLE_APPLICATION_CERT_PASSWORD: ${{ secrets.APPLE_APPLICATION_CERT_PASSWORD }} run: | keychain="$RUNNER_TEMP/buildagent.keychain" keychain_password="password1" security create-keychain -p "$keychain_password" "$keychain" security default-keychain -s "$keychain" security unlock-keychain -p "$keychain_password" "$keychain" base64 -D <<<"$APPLE_APPLICATION_CERT" > "$RUNNER_TEMP/cert.p12" security import "$RUNNER_TEMP/cert.p12" -k "$keychain" -P "$APPLE_APPLICATION_CERT_PASSWORD" -T /usr/bin/codesign security set-key-partition-list -S "apple-tool:,apple:,codesign:" -s -k "$keychain_password" "$keychain" rm "$RUNNER_TEMP/cert.p12" - name: Install GoReleaser uses: goreleaser/goreleaser-action@v6 with: version: "~1.17.1" install-only: true - name: Build release binaries env: TAG_NAME: ${{ inputs.tag_name }} APPLE_DEVELOPER_ID: ${{ vars.APPLE_DEVELOPER_ID }} run: script/release --local "$TAG_NAME" --platform macos - name: Notarize macOS archives if: inputs.environment == 'production' env: APPLE_ID: ${{ vars.APPLE_ID }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} APPLE_DEVELOPER_ID: ${{ vars.APPLE_DEVELOPER_ID }} run: | shopt -s failglob script/sign dist/gh_*_macOS_*.zip - name: Build universal macOS pkg installer if: inputs.environment != 'production' env: TAG_NAME: ${{ inputs.tag_name }} run: script/pkgmacos "$TAG_NAME" - name: Build & notarize universal macOS pkg installer if: inputs.environment == 'production' env: TAG_NAME: ${{ inputs.tag_name }} APPLE_DEVELOPER_INSTALLER_ID: ${{ vars.APPLE_DEVELOPER_INSTALLER_ID }} run: | shopt -s failglob script/pkgmacos "$TAG_NAME" - uses: actions/upload-artifact@v4 with: name: macos if-no-files-found: error retention-days: 7 path: | dist/*.tar.gz dist/*.zip dist/*.pkg ``` -------------------------------- ### Start MCP Server using github-mcp-server Source: https://github.com/moving33/cli/blob/trunk/pkg/cmd/agent-task/shared/testdata/log-2-input.txt Initiates the MCP server with the github-mcp-server version. Displays a list of available tools and directs users to verbose logs for full output. This is typically used for GitHub-related MCP operations. ```shell MCP server started successfully (version github-mcp-server/remote-84df50f6d2a32c75816994627b178853b0fdfc7b) with 39 tools - for the full output, see the verbose logs - download_workflow_run_artifact - get_code_scanning_alert - get_commit - get_file_contents - get_issue - get_issue_comments - get_job_logs - get_latest_release - get_pull_request - get_pull_request_comments - get_pull_request_diff - get_pull_request_files - get_pull_request_reviews - get_pull_request_status - get_release_by_tag - get_secret_scanning_alert - get_tag - get_workflow_run - get_workflow_run_logs - get_workflow_run_usage - list_branches - list_code_scanning_alerts - list_commits - list_issue_types - list_issues - list_pull_requests - list_releases - list_secret_scanning_alerts - list_sub_issues - list_tags - list_workflow_jobs - list_workflow_run_artifacts - list_workflow_runs - list_workflows - search_code - search_issues - search_pull_requests - search_repositories - search_users ``` -------------------------------- ### Start MCP Server using Playwright Source: https://github.com/moving33/cli/blob/trunk/pkg/cmd/agent-task/shared/testdata/log-2-input.txt Initiates the MCP server with the Playwright version. Lists the available browser automation tools and suggests checking verbose logs for complete output. Useful for browser-based testing and automation tasks. ```shell MCP server started successfully (version 0.0.35) with 21 tools - for the full output, see the verbose logs - browser_close - browser_resize - browser_console_messages - browser_handle_dialog - browser_evaluate - browser_file_upload - browser_fill_form - browser_install - browser_press_key - browser_type - browser_navigate - browser_navigate_back - browser_network_requests - browser_take_screenshot - browser_snapshot - browser_click - browser_drag - browser_hover - browser_select_option - browser_tabs - browser_wait_for ``` -------------------------------- ### Install GitHub CLI with Chocolatey Source: https://github.com/moving33/cli/blob/trunk/docs/install_windows.md Installs the GitHub CLI using the Chocolatey package manager. This is an unofficial community-maintained installation method. Chocolatey is a popular package manager for Windows. Ensure Chocolatey is installed before running this command. ```pwsh choco install gh ``` -------------------------------- ### Install GitHub CLI on Amazon Linux 2 (yum) Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Installs the GitHub CLI on Amazon Linux 2 using yum. It installs 'yum-utils' if not present, adds the GitHub CLI repository, and then installs the 'gh' package. ```bash type -p yum-config-manager >/dev/null || sudo yum install yum-utils sudo yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo sudo yum install gh ``` -------------------------------- ### Build and Execute GitHub CLI Command Source: https://github.com/moving33/cli/blob/trunk/docs/project-layout.md This snippet illustrates the process of building the GitHub CLI binary and executing a sample command. It shows the `go run` command for compilation and the subsequent execution of the `bin/gh` binary with arguments. Note the platform-specific path separator for Windows. ```shell # Build the GitHub CLI binary go run script/build.go # Execute a sample command on Unix-like systems ./bin/gh issue list --limit 5 # Execute a sample command on Windows (using backslashes) bin\gh issue list --limit 5 ``` -------------------------------- ### Install gh CLI using Spack on macOS Source: https://github.com/moving33/cli/blob/trunk/docs/install_macos.md Installs or upgrades the GitHub CLI using Spack, a flexible package manager that supports multiple versions and configurations. Installation involves uninstalling the old version and then installing the new one. ```shell spack install gh ``` ```shell spack uninstall gh && spack install gh ``` -------------------------------- ### Install GitHub CLI on OpenBSD Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Install the GitHub CLI port on OpenBSD systems using the pkg_add command. This command installs the 'github-cli' package. ```shell pkg_add github-cli ``` -------------------------------- ### Root Command Initialization and Execution Source: https://github.com/moving33/cli/blob/trunk/docs/project-layout.md Demonstrates the initialization and execution of the root command in the GitHub CLI. The `main` function in `cmd/gh/main.go` sets up the root command using `root.NewCmdRoot()` and then dispatches execution using `rootCmd.ExecuteC()`. This is central to how commands are parsed and routed. ```Go package main import ( "os" "github.com/cli/cli/v2/cmd/gh/internal/gh" "github.com/cli/cli/v2/pkg/cmd/root" ) func main() { // Initialize the root command rootCmd := root.NewCmdRoot() // Execute the command with arguments from os.Args // ExecuteC handles command parsing, execution, and error handling rootCmd.ExecuteC() } ``` -------------------------------- ### Install GitHub CLI on NetBSD/pkgsrc Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Install the GitHub CLI package on NetBSD systems using the pkgsrc package manager. This command installs the 'gh' package. ```bash pkgin install gh ``` -------------------------------- ### Fetch GitHub User Login with Go (go-gh) Source: https://github.com/moving33/cli/blob/trunk/pkg/cmd/extension/ext_tmpls/goBinMain.go.txt This Go code snippet demonstrates how to initialize a REST client using go-gh and fetch the current authenticated user's login information from the GitHub API. It handles potential errors during client initialization and API requests. ```go package main import ( "fmt" "github.com/cli/go-gh/v2/pkg/api" ) func main() { fmt.Println("hi world, this is the %s extension!") client, err := api.DefaultRESTClient() if err != nil { fmt.Println(err) return } response := struct{Login string}{} err = client.Get("user", &response) if err != nil { fmt.Println(err) return } fmt.Printf("running as %%s\n", response.Login) } // For more examples of using go-gh, see: // https://github.com/cli/go-gh/blob/trunk/example_gh_test.go ``` -------------------------------- ### Parse and Compare Versions in Go Source: https://github.com/moving33/cli/blob/trunk/third-party/github.com/hashicorp/go-version/README.md Demonstrates how to parse version strings into Version objects and compare them using LessThan. Handles SemVer with metadata. ```go v1, err := version.NewVersion("1.2") v2, err := version.NewVersion("1.5+metadata") // Comparison example. There is also GreaterThan, Equal, and just // a simple Compare that returns an int allowing easy >=, <=, etc. if v1.LessThan(v2) { fmt.Printf("%s is less than %s", v1, v2) } ``` -------------------------------- ### Create Sample YAML Data File Source: https://github.com/moving33/cli/blob/trunk/pkg/cmd/agent-task/shared/testdata/log-2-input.txt Generates a YAML file named 'sample-data.yaml' containing diverse data types and structures. This file serves as a comprehensive example for understanding YAML syntax and capabilities. It includes configurations for application, database, features, regions, metadata, API, monitoring, and demonstrates various scalar types and nested mappings. ```yaml # Sample YAML file with random fields demonstrating various data types application: name: "RandomApp" version: "2.4.7" environment: "production" debug_mode: false max_connections: 1000 timeout_seconds: 30.5 database: host: "db.example.com" port: 5432 username: "app_user" ssl_enabled: true connection_pool: min_size: 5 max_size: 20 idle_timeout: 300 features: - name: "user_authentication" enabled: true priority: 1 - name: "file_upload" enabled: false priority: 3 - name: "real_time_notifications" enabled: true priority: 2 regions: - us-east-1 - us-west-2 - eu-central-1 - ap-southeast-1 metadata: created_at: "2023-09-15T10:30:00Z" updated_at: "2024-01-20T14:45:30Z" tags: team: "backend" cost_center: "engineering" criticality: "high" api: base_url: "https://api.example.com/v1" rate_limit: 1000 retry_attempts: 3 endpoints: users: "/users" orders: "/orders" analytics: "/analytics" monitoring: health_check: path: "/health" interval: 60 timeout: 10 metrics: enabled: true export_format: "prometheus" retention_days: 30 random_numbers: - 42 - 3.14159 - -17 - 0.001 - 9999999 random_booleans: feature_flag_a: true feature_flag_b: false experimental_mode: true maintenance_mode: false nested_config: level1: level2: level3: deep_value: "Found me!" treasure: 12345 coordinates: x: 10.5 y: -20.3 z: 100 ``` -------------------------------- ### Install GitHub CLI on Arch Linux Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Install the GitHub CLI package on Arch Linux using pacman. This command installs the latest stable version from the Arch Linux repositories. ```bash sudo pacman -S github-cli ``` -------------------------------- ### Sample YAML Data Structure Source: https://github.com/moving33/cli/blob/trunk/pkg/cmd/agent-task/shared/testdata/log-2-input.txt Demonstrates a sample YAML structure with various data types and nested configurations. This file serves as an example for diverse data representation in YAML, covering application settings, feature flags, and nested configurations up to multiple levels deep. ```yaml application: name: "RandomApp" version: "2.4.7" debug_mode: false max_connections: 1000 features: - name: "user_authentication" enabled: true priority: 1 - name: "file_upload" enabled: false priority: 3 nested_config: level1: level2: level3: deep_value: "Found me!" coordinates: x: 10.5 y: -20.3 ``` -------------------------------- ### Cross-compile GitHub CLI for Raspberry Pi (Windows) Source: https://github.com/moving33/cli/blob/trunk/docs/install_source.md Demonstrates cross-compiling the GitHub CLI binary for a 32-bit Raspberry Pi OS (Linux ARMv7) on a Windows system. Environment variables are passed as arguments to the build script, disabling Cgo for a static build. ```pwsh # on Windows, pass environment variables as arguments to the build script: > go run script\build.go clean bin\gh GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 ``` -------------------------------- ### GitHub CLI Main Entry Point (Go) Source: https://context7.com/moving33/cli/llms.txt This Go code snippet demonstrates the main entry point for the GitHub CLI application. It initializes the command execution and handles the exit code. This is the primary function called when the `gh` executable is run. ```go package main import ( "os" "github.com/cli/cli/v2/internal/ghcmd" ) func main() { code := ghcmd.Main() os.Exit(int(code)) } ``` -------------------------------- ### Install gh CLI using Homebrew on macOS Source: https://github.com/moving33/cli/blob/trunk/docs/install_macos.md Installs or upgrades the GitHub CLI using the Homebrew package manager. Homebrew is a popular package manager for macOS and Linux, simplifying software installation. ```shell brew install gh ``` ```shell brew upgrade gh ``` -------------------------------- ### Cross-compile GitHub CLI for Raspberry Pi (Unix-like) Source: https://github.com/moving33/cli/blob/trunk/docs/install_source.md Demonstrates cross-compiling the GitHub CLI binary for a 32-bit Raspberry Pi OS (Linux ARMv7) on a Unix-like system. It cleans previous builds and compiles with specific GOOS, GOARCH, and GOARM environment variables, disabling Cgo for a static build. ```sh # on a Unix-like system: $ GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 make clean bin/gh ``` -------------------------------- ### Install gh CLI using MacPorts on macOS Source: https://github.com/moving33/cli/blob/trunk/docs/install_macos.md Installs or upgrades the GitHub CLI using MacPorts, an open-source system for compiling and installing software on macOS. Requires updating MacPorts itself before upgrading the gh port. ```shell sudo port install gh ``` ```shell sudo port selfupdate && sudo port upgrade gh ``` -------------------------------- ### Install gh CLI using Webi on macOS Source: https://github.com/moving33/cli/blob/trunk/docs/install_macos.md Installs or upgrades the GitHub CLI using Webi, a tool for effortless installation of developer tools via simple URLs. This method does not require sudo or a package manager. ```shell curl -sS https://webi.sh/gh | sh ``` ```shell webi gh@stable ``` -------------------------------- ### Discover Project Files Source: https://github.com/moving33/cli/blob/trunk/pkg/cmd/agent-task/shared/testdata/log-2-input.txt Finds documentation and configuration files within the repository to understand its structure. It searches for files with common extensions like .md, .txt, .json, .yaml, and .yml. The output is limited to the first 20 files found. ```bash cd /home/runner/work/foo/foo && find . -type f -name "*.md" -o -name "*.txt" -o -name "*.json" -o -name "*.yaml" -o -name "*.yml" | head -20 ``` -------------------------------- ### Install GitHub CLI on Alpine Linux (edge) Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Installs the edge release of the GitHub CLI on Alpine Linux. It first adds the 'edge' community repository to the package manager configuration and then installs the 'gh' package from that repository. ```bash echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories apk add github-cli@community ``` -------------------------------- ### Install GitHub CLI with Homebrew Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Installs the GitHub CLI using the Homebrew package manager on macOS and Linux systems. ```shell brew install gh ``` -------------------------------- ### Shell Command Syntax Examples Source: https://github.com/moving33/cli/blob/trunk/docs/primer/components/README.md Demonstrates various syntax elements used in shell commands to indicate literal text, placeholder values, optional arguments, mutually exclusive arguments, repeatable arguments, and variable naming conventions. ```shell gh help ``` ```shell gh pr view ``` ```shell gh pr checkout [--web] ``` ```shell gh pr view [ | ] ``` ```shell gh pr {view | create} ``` ```shell gh pr close ... ``` ```shell gh pr checkout ``` ```shell [] ``` ```shell { | | literal} ``` ```shell [ | ] ``` -------------------------------- ### YAML Configuration Example Source: https://github.com/moving33/cli/blob/trunk/pkg/cmd/agent-task/shared/testdata/log-2-want.txt This snippet displays a comprehensive YAML configuration file. It includes various data types such as strings, numbers, booleans, lists, and nested objects to define application settings, database parameters, feature flags, API endpoints, and monitoring configurations. ```yaml application: name: "RandomApp" version: "2.4.7" environment: "production" debug_mode: false max_connections: 1000 timeout_seconds: 30.5 database: host: "db.example.com" port: 5432 username: "app_user" ssl_enabled: true connection_pool: min_size: 5 max_size: 20 idle_timeout: 300 features: - name: "user_authentication" enabled: true priority: 1 - name: "file_upload" enabled: false priority: 3 - name: "real_time_notifications" enabled: true priority: 2 regions: - us-east-1 - us-west-2 - eu-central-1 - ap-southeast-1 metadata: created_at: "2023-09-15T10:30:00Z" updated_at: "2024-01-20T14:45:30Z" tags: team: "backend" cost_center: "engineering" criticality: "high" api: base_url: "https://api.example.com/v1" rate_limit: 1000 retry_attempts: 3 endpoints: users: "/users" orders: "/orders" analytics: "/analytics" monitoring: health_check: path: "/health" interval: 60 timeout: 10 metrics: enabled: true export_format: "prometheus" retention_days: 30 ``` -------------------------------- ### Install and Upgrade GitHub CLI on Android (Termux) Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Installs and upgrades the GitHub CLI on Android devices using the Termux package manager. ```bash pkg install gh ``` -------------------------------- ### GitHub GraphQL API Client Example (Go) Source: https://context7.com/moving33/cli/llms.txt This Go code snippet shows how to use the GitHub CLI's API client to execute a GraphQL query. It demonstrates creating an authenticated HTTP client, defining a GraphQL query, setting variables, and processing the response. This enables fetching repository details like stargazers, issues, and pull requests. ```go package main import ( "fmt" "net/http" "github.com/cli/cli/v2/api" ) func main() { // Create authenticated HTTP client (from factory) httpClient := &http.Client{} // In practice, use factory.HttpClient() client := api.NewClientFromHTTP(httpClient) // Define GraphQL query query := ` query($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { name description stargazerCount issues(states: OPEN) { totalCount } pullRequests(states: OPEN) { totalCount } } } ` // Set variables variables := map[string]interface{}{ "owner": "cli", "repo": "cli", } // Execute query var response struct { Repository struct { Name string Description string StargazerCount int Issues struct{ TotalCount int } PullRequests struct{ TotalCount int } } } err := client.GraphQL("github.com", query, variables, &response) if err != nil { fmt.Printf("GraphQL error: %v\n", err) return } fmt.Printf("Repository: %s\n", response.Repository.Name) fmt.Printf("Stars: %d\n", response.Repository.StargazerCount) fmt.Printf("Open Issues: %d\n", response.Repository.Issues.TotalCount) fmt.Printf("Open PRs: %d\n", response.Repository.PullRequests.TotalCount) } ``` -------------------------------- ### Install GitHub CLI on Alpine Linux (stable) Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Installs the stable release of the GitHub CLI on Alpine Linux using the apk package manager. ```bash apk add github-cli ``` -------------------------------- ### Initiate Production Deployment - script/release Source: https://github.com/moving33/cli/blob/trunk/docs/releasing.md This command initiates a new production deployment for the specified version (vX.Y.Z). It triggers a comprehensive release process involving building binaries, uploading artifacts, and updating various platforms. Run `script/release --help` for more options. ```shell script/release vX.Y.Z ``` -------------------------------- ### Install GitHub CLI on FreeBSD Source: https://github.com/moving33/cli/blob/trunk/docs/install_linux.md Install the GitHub CLI port on FreeBSD systems. This can be done by manually compiling the port or using the pkg package manager. ```bash cd /usr/ports/devel/gh/ && make install clean ``` ```bash pkg install gh ``` -------------------------------- ### Make Script Executable and Run (Bash) Source: https://github.com/moving33/cli/blob/trunk/pkg/cmd/agent-task/shared/testdata/log-1-want.txt This command sequence demonstrates how to make a shell script executable and then run it. It changes the directory, sets execute permissions using 'chmod +x', and then executes the script. ```bash cd /home/runner/work/foo/foo && chmod +x os_info.sh && ./os_info.sh ```