Enhance README with additional function usage examples and option descriptions
This commit is contained in:
48
README.md
48
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 <name>`: choose an exact asset name.
|
||||
- `--type <archive|package|zip|tar.gz|tgz|deb|pkg|rpm>`: filter by asset type.
|
||||
- `--binary-name <src[:dest]>`: install binary using optional destination name.
|
||||
- `--output-directory <dir>`: download only, do not install.
|
||||
- `--releases-json`: download latest release metadata as JSON.
|
||||
- `-l, --list`: print release asset URLs.
|
||||
- `-f, --file-name <name>`: choose an exact asset name.
|
||||
- `-t, --type <archive|package|zip|tar.gz|tgz|deb|pkg|rpm>`: filter by asset type.
|
||||
- `-b, --binary-name <src[:dest]>`: install binary using optional destination name.
|
||||
- `-a, --app-name <name>`: set application display name.
|
||||
- `-o, --output-directory <dir>`: 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"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user