Skip to content

Commit

Permalink
Merge pull request #35 from oalders/parse-more
Browse files Browse the repository at this point in the history
Parse versions for: dig, perldoc, fpp, fzf, screen, sqlite3 and typos
  • Loading branch information
oalders authored Jun 22, 2024
2 parents d24d07c + 741332f commit 695415b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import (

func CLIOutput(ctx *types.Context, cliName string) (string, error) {
versionArg := map[string]string{
"dig": "-v",
"go": "version",
"lua": "-v",
"openssl": "version",
"perldoc": "-V",
"pihole": "-v",
"ssh": "-V",
"tmux": "-V",
Expand Down Expand Up @@ -76,6 +78,8 @@ func CLIVersion(ctx *types.Context, cliName, output string) string {
"csh": fmt.Sprintf(`(%s)`, semverRegex),
"curl": fmt.Sprintf(`curl (%s)\b`, floatRegex),
"docker": fmt.Sprintf(`version (%s),`, floatRegex),
"fpp": fmt.Sprintf(`version (%s)\b`, floatRegex),
"fzf": fmt.Sprintf(`(%s)\b`, floatRegex),
"gcc": fmt.Sprintf(`clang version (%s)\b`, floatRegex),
"git": fmt.Sprintf(`git version (%s)\s`, floatRegex),
"gh": fmt.Sprintf(`gh version (%s)\b`, floatRegex),
Expand All @@ -89,6 +93,7 @@ func CLIVersion(ctx *types.Context, cliName, output string) string {
"ocaml": fmt.Sprintf(`The OCaml toplevel, version (%s)`, semverRegex),
"opam": fmt.Sprintf(`(%s)`, semverRegex),
"openssl": fmt.Sprintf(`SSL (%s)\b`, floatWithTrailingLetterRegex),
"perldoc": fmt.Sprintf(`(%s)\b`, vStringRegex),
"pihole": fmt.Sprintf(`Pi-hole version is (%s)`, vStringRegex),
"plenv": `plenv ([\d\w\-\.]*)\b`,
"python": fmt.Sprintf(`Python (%s)\b`, floatRegex),
Expand All @@ -97,9 +102,12 @@ func CLIVersion(ctx *types.Context, cliName, output string) string {
"ruby": `ruby (\d+\.\d+\.[\d\w]+)\b`,
"tcsh": fmt.Sprintf(`(%s)`, semverRegex),
"rustc": fmt.Sprintf(`rustc (%s)\b`, floatRegex),
"screen": fmt.Sprintf(`version (%s)\b`, floatRegex),
"sh": fmt.Sprintf(`version (%s)\b`, floatRegex),
"sqlite3": fmt.Sprintf(`(%s)\b`, floatRegex),
"ssh": `OpenSSH_([0-9a-z.]*)\b`,
"tar": fmt.Sprintf(`bsdtar (%s)\b`, floatRegex),
"typos": fmt.Sprintf(`typos-cli (%s)\b`, floatRegex),
"tmux": fmt.Sprintf(`tmux (%s)\b`, floatWithTrailingLetterRegex),
"tree": fmt.Sprintf(`tree (%s)\b`, vStringWithTrailingLetterRegex),
"trurl": fmt.Sprintf(`trurl version (%s)\b`, floatRegex),
Expand Down
7 changes: 7 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ Release-Date: 2023-02-20
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL threadsafe UnixSockets`,
},
{"dig", "9.10.6", "DiG 9.10.6"},
{"docker", "20.10.21", "version 20.10.21, build baeda1f"},
{"fpp", "0.9.2", "fpp version 0.9.2"},
{"fzf", "0.53.0", "0.53.0 (c4a9ccd)"},
{"gcc", "14.0.3", "clang version 14.0.3 (clang-1403.0.22.14.1)"},
{"gh", "2.30.0", "gh version 2.30.0 (2023-05-30)"},
{"go", "1.20.4", "go version go1.20.4 darwin/amd64"},
Expand Down Expand Up @@ -80,6 +83,7 @@ General Public License, which is included in the distribution files.
Complete documentation for perltidy can be found using 'man perltidy'
or on the internet at http://perltidy.sourceforge.net.
`},
{"perldoc", "v3.2801", "v3.2801, under perl v5.040000 for darwin"},
{
"pihole", "v5.17.1",
` Pi-hole version is v5.17.1 (Latest: v5.17.1)
Expand All @@ -91,9 +95,11 @@ or on the internet at http://perltidy.sourceforge.net.
{"python3", "3.11.3", "Python 3.11.3"},
{"ripgrep", "13.0.0", "ripgrep 13.0.0"},
{"rustc", "1.73.0", "rustc 1.73.0 (cc66ad468 2023-10-03)"},
{"screen", "4.08.00", "Screen version 4.08.00 (GNU) 05-Feb-20"},
{"sh", "3.2.57", `GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin22)
Copyright (C) 2007 Free Software Foundation, Inc.
`},
{"sqlite3", "3.46.0", "3.46.0 2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e (64-bit)"},
{"tar", "3.5.3", "bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8"},
{"tcsh", "6.21.00", "tcsh 6.21.00 (Astron) 2019-05-08 (x86_64-apple-darwin) options wide,nls,dl,bye,al,kan,sm,rh,color,filec"},
{"trurl", "0.6", "trurl version 0.6 libcurl/7.88.1 [built-with 7.87.0]"},
Expand All @@ -102,6 +108,7 @@ Copyright (C) 2007 Free Software Foundation, Inc.
"tree", "v2.1.0",
`tree v2.1.0 © 1996 - 2022 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro`,
},
{"typos", "1.22.7", "typos-cli 1.22.7"},
{"ubi", "0.0.24", "ubi 0.0.24"},
{
"unzip", "6.00",
Expand Down

0 comments on commit 695415b

Please sign in to comment.