From afdfa13f32cf9f7327813535ed89d9cd5733fbdc Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Thu, 26 Mar 2026 14:50:18 +0100 Subject: [PATCH] Enhance README with additional function usage examples and option descriptions --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8f87aad..86fda41 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,14 @@ Examples: Useful options: - `--dry-run [level]`: test mode, print what would happen. -- `--list`: print release asset URLs. -- `--file-name `: choose an exact asset name. -- `--type `: filter by asset type. -- `--binary-name `: install binary using optional destination name. -- `--output-directory `: download only, do not install. -- `--releases-json`: download latest release metadata as JSON. +- `-l, --list`: print release asset URLs. +- `-f, --file-name `: choose an exact asset name. +- `-t, --type `: filter by asset type. +- `-b, --binary-name `: install binary using optional destination name. +- `-a, --app-name `: set application display name. +- `-o, --output-directory `: download only, do not install. +- `-j, --releases-json`: download latest release metadata as JSON. +- `-h, --help`: show usage help. For full help: @@ -45,3 +47,37 @@ For full help: ./github-release-installer --help ``` +### Function usage (when sourced) + +If the script is sourced from another installer script, call `github_release_installer` directly. +Use environment variables to set options, for example: + +- `ASSET_TYPE='\.tar\.gz$'` to filter for tar.gz assets. +- `ASSET_NAME='gh_2.70.0_macOS_arm64.zip'` to pick an exact file. +- `TEST_MODE=1` to run without downloading/installing. +- `OUTPUT_DIR='/tmp'` to download only. +- `SYSTEM` and `ARCH` to override platform detection. + +```bash +source "$(dirname "$0")/github-release-installer" + +ASSET_TYPE='\.tar\.gz$' +github_release_installer "Databricks CLI" "databricks" "databricks/cli" + +# Pick a specific asset by exact filename +ASSET_NAME='gh_2.70.0_macOS_arm64.zip' +github_release_installer "GitHub CLI" "gh" "cli/cli" + +# Dry-run mode (no side effects) +TEST_MODE=1 +github_release_installer "GitHub CLI" "gh" "cli/cli" + +# Download only (no install) +OUTPUT_DIR='/tmp' +github_release_installer "GitHub CLI" "gh" "cli/cli" + +# Override platform detection +SYSTEM='linux' +ARCH='x86_64' +github_release_installer "GitHub CLI" "gh" "cli/cli" +```