mirror of https://github.com/Hilbis/Hilbish
Compare commits
3 Commits
cb88db8cfc
...
ab8b9c8376
Author | SHA1 | Date |
---|---|---|
TorchedSammy | ab8b9c8376 | |
TorchedSammy | 5dd2af7250 | |
TorchedSammy | ac21109307 |
2
Makefile
2
Makefile
|
@ -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
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
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()
|
||||
}
|
||||
|
|
9
vars.go
9
vars.go
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue