bugfixes and more tools (#61)

- `cmake`
- `openssh`/`ssh`

- `openssl` now includes letters at the end (eg. "1.1.1j")
- `has` didn't actually detect its own version
This commit is contained in:
Alex Meyer 2023-07-28 09:35:54 -04:00 committed by GitHub
parent 49444b3179
commit c12a38bbdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 3 deletions

18
has
View File

@ -103,6 +103,7 @@ __detect(){
case ${name} in
rust ) command="rustc" ;;
ssl ) command="openssl" ;;
openssh ) command="ssh" ;;
golang ) command="go" ;;
jre ) command="java" ;;
jdk ) command="javac" ;;
@ -166,7 +167,7 @@ __detect(){
groovy|node) __dynamic_detect--version "${command}" ;;
## Compile
gcc|make|bats) __dynamic_detect--version "${command}" ;;
gcc|make|cmake|bats) __dynamic_detect--version "${command}" ;;
ninja) __dynamic_detect--version "${command}" ;;
## Build tools
@ -208,7 +209,6 @@ __detect(){
# commands that need version arg
go|hugo) __dynamic_detect-arg_version "${command}" ;;
openssl) __dynamic_detect-arg_version "${command}" ;;
## Example of commands that need custom processing
@ -228,6 +228,18 @@ __detect(){
status=$?
;;
# openssl can have a letter at the end of the version number (eg. "1.1.1j")
openssl)
version=$( openssl version 2>&1 | grep -Eo "${REGEX_SIMPLE_VERSION}[[:alnum:]]*" |head -1)
status=$?
;;
# openssh version output has a lot going on
ssh)
version=$(ssh -V 2>&1 |grep -Eo "OpenSSH_${REGEX_SIMPLE_VERSION}[[:alnum:]]*" |cut -d'_' -f2)
status=$?
;;
## use 'readlink' to test for GNU coreutils
# readlink (GNU coreutils) 8.28
gnu_coreutils) __dynamic_detect--version readlink ;;
@ -245,7 +257,7 @@ __detect(){
;;
has)
version=$( has 2>&1 | grep -Eo "${REGEX_SIMPLE_VERSION}" | head -1)
version=$( has -V 2>&1 | grep -Eo "${REGEX_SIMPLE_VERSION}" | head -1)
status=$?
;;