From 05ccf19e75c232cb487d0801f59fd56bf68e4da4 Mon Sep 17 00:00:00 2001 From: Luca Scalzotto Date: Mon, 19 Feb 2024 17:10:39 +0100 Subject: [PATCH] Add Lua version section (#28) --- README.md | 1 + internal/versions/all.go | 1 + internal/versions/lua.go | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 internal/versions/lua.go diff --git a/README.md b/README.md index e6bc275..adea830 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ This should print a "branch" icon. - .NET - Go - Java + - Lua - Node.js - PHP - Python diff --git a/internal/versions/all.go b/internal/versions/all.go index 1ce3ff7..7ccd07e 100644 --- a/internal/versions/all.go +++ b/internal/versions/all.go @@ -9,6 +9,7 @@ var sections = []section{ Dotnet, Go, Java, + Lua, Node, Php, Python, diff --git a/internal/versions/lua.go b/internal/versions/lua.go new file mode 100644 index 0000000..74555d4 --- /dev/null +++ b/internal/versions/lua.go @@ -0,0 +1,24 @@ +package versions + +import ( + "gokart-prompt/internal/ansi" + "strings" +) + +var Lua = section{ + symbol: "🌙", + color: ansi.Blue, + + wdFiles: []string{ + "*.lua", + }, + + command: []string{"lua", "-v"}, + versionFn: func(output string) string { + /* + Example: + Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio + */ + return "v" + strings.SplitN(output, " ", 3)[1] + }, +}