2
2
ミラー元 https://github.com/Hilbis/Hilbish 前回の同期 2025-07-14 14:52:02 +00:00

コミットを比較

...

3 コミット

作成者 SHA1 メッセージ 日付
TorchedSammy
ab8b9c8376
feat: add hilbish.version interface 2022-05-17 06:39:30 -04:00
TorchedSammy
5dd2af7250
fix: add release name to version 2022-05-17 06:39:05 -04:00
TorchedSammy
ac21109307
fix: change how version is retrieved 2022-05-16 19:36:34 -04:00
4個のファイルの変更36行の追加4行の削除

ファイルの表示

@ -6,7 +6,7 @@ MY_GOFLAGS = -ldflags "-s -w"
all: dev
dev: MY_GOFLAGS = -ldflags "-s -w -X main.version=$(shell git describe --tags)"
dev: MY_GOFLAGS = -ldflags "-s -w -X main.gitCommit=$(shell git rev-parse --short HEAD) -X main.gitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
dev: build
build:

10
api.go
ファイルの表示

@ -107,7 +107,7 @@ func hilbishLoad(rtm *rt.Runtime) (rt.Value, func()) {
The nice lil shell for {blue}Lua{reset} fanatics!
Check out the {blue}{bold}guide{reset} command to get started.
`
util.SetFieldProtected(fakeMod, mod, "ver", rt.StringValue(version), "Hilbish version")
util.SetFieldProtected(fakeMod, mod, "ver", rt.StringValue(getVersion()), "Hilbish version")
util.SetFieldProtected(fakeMod, mod, "user", rt.StringValue(username), "Username of user")
util.SetFieldProtected(fakeMod, mod, "host", rt.StringValue(host), "Host name of the machine")
util.SetFieldProtected(fakeMod, mod, "home", rt.StringValue(curuser.HomeDir), "Home directory of the user")
@ -174,6 +174,14 @@ Check out the {blue}{bold}guide{reset} command to get started.
util.Document(editorModule, "")
mod.Set(rt.StringValue("editor"), rt.TableValue(editorModule))
versionModule := rt.NewTable()
util.SetField(rtm, versionModule, "branch", rt.StringValue(gitBranch), "Git branch Hilbish was compiled from")
util.SetField(rtm, versionModule, "full", rt.StringValue(getVersion()), "Full version info, including release name")
util.SetField(rtm, versionModule, "commit", rt.StringValue(gitCommit), "Git commit Hilbish was compiled from")
util.SetField(rtm, versionModule, "release", rt.StringValue(releaseName), "Release name")
util.Document(versionModule, "Version info interface.")
mod.Set(rt.StringValue("version"), rt.TableValue(versionModule))
return rt.TableValue(fakeMod), nil
}

19
main.go
ファイルの表示

@ -106,7 +106,7 @@ func main() {
}
if *verflag {
fmt.Printf("Hilbish %s\n", version)
fmt.Printf("Hilbish %s\n", getVersion())
os.Exit(0)
}
@ -303,3 +303,20 @@ func exit(code int) {
}
}
}
func getVersion() string {
v := strings.Builder{}
v.WriteString(ver)
if gitBranch != "" && gitBranch != "HEAD" {
v.WriteString("-" + gitBranch)
}
if gitCommit != "" {
v.WriteString("." + gitCommit)
}
v.WriteString(" (" + releaseName + ")")
return v.String()
}

ファイルの表示

@ -2,7 +2,6 @@ package main
// String vars that are free to be changed at compile time
var (
version = "v2.0.0"
defaultHistDir = ""
commonRequirePaths = "';./libs/?/init.lua;./?/init.lua;./?/?.lua'"
@ -10,6 +9,14 @@ var (
multilinePrompt = "> "
)
// Version info
var (
ver = "v2.0.0"
releaseName = "Hibiscus"
gitCommit string
gitBranch string
)
// Flags
var (
running bool // Is a command currently running