One straightforward way is to use GitHub’s API with a tool like curl (and optionally jq for nicer JSON parsing). Here are a few methods:
Method 1: Using curl and grep
Run the following command in your terminal to fetch the latest release and extract the tag name:
curl -s https://api.github.com/repos/argp-standalone/argp-standalone/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
This command:
- Fetches the latest release data silently (
-s).
- Filters the line containing
"tag_name":.
- Uses
sed to extract just the version/tag name.
Method 2: Using curl and jq
If you have jq installed, you can prettify the JSON output and extract the tag like this:
curl -s https://api.github.com/repos/argp-standalone/argp-standalone/releases/latest | jq -r '.tag_name'
This command prints only the tag name in raw format.
Method 3: Using the GitHub CLI (gh)
If you have the GitHub CLI installed and authenticated, you can use:
gh release view --json tagName --jq '.tagName'
This will display the latest release’s tag name.
Method 4: Listing All Tags via Git
Alternatively, if you want to see all available tags (even though they might not be strictly sorted as releases), you can run:
git ls-remote --tags https://github.com/argp-standalone/argp-standalone.git
This command lists all the tags on the remote. You can then inspect or sort them manually to determine the most recent version.
Choose the method that best suits your setup. The GitHub API methods (Methods 1 and 2) are usually the simplest for quickly checking the latest release version from your terminal.