Version Functions
The ghqc R package exposes two version helpers:
ghqc::ghqc_version()ghqc::ghqc_remote_version()
Use them together to compare what is installed locally with the latest published release.
ghqc::ghqc_version()
Section titled “ghqc::ghqc_version()”ghqc::ghqc_version() returns the version of the installed ghqc binary.
ghqc::ghqc_version()Behavior:
- it runs
ghqc --version - it strips either
ghqctoolkitorghqcfrom the command output - it returns a plain version string such as
"0.4.2"without a leadingv
If the ghqc binary is not installed, the function errors and tells you to run ghqc::ghqc_install().
ghqc::ghqc_remote_version()
Section titled “ghqc::ghqc_remote_version()”ghqc::ghqc_remote_version() returns the tag of the latest GitHub release for a2-ai/ghqctoolkit.
ghqc::ghqc_remote_version()Behavior:
- it queries the GitHub Releases API with
curl - it extracts the latest release
tag_name - it returns a tag such as
"v0.4.2"with the leadingvpreserved
If the request fails, the function prints a warning and returns NULL invisibly instead of erroring.
Example
Section titled “Example”local_version <- ghqc::ghqc_version()remote_version <- ghqc::ghqc_remote_version()
local_versionremote_versionCommon Use
Section titled “Common Use”These helpers are mainly useful for:
- checking whether the CLI is installed correctly
- confirming which version the R package is launching
- deciding whether to run
ghqc::ghqc_install()again