Compare commits

..

No commits in common. "196526cc6a261a14ff2baf14907583a49622ef31" and "822b2876e9168e6ab53b67999e45291469c4258b" have entirely different histories.

5 changed files with 13 additions and 37 deletions

View File

@ -5,7 +5,6 @@ package main
import ( import (
"os" "os"
"strings"
"github.com/pborman/getopt" "github.com/pborman/getopt"
"github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua"
@ -22,10 +21,9 @@ func HilbishLoader(L *lua.LState) int {
mod := L.SetFuncs(L.NewTable(), exports) mod := L.SetFuncs(L.NewTable(), exports)
host, _ := os.Hostname() host, _ := os.Hostname()
username := strings.Split(curuser.Username, "\\")[1] // for some reason Username includes the hostname on windows
L.SetField(mod, "ver", lua.LString(version)) L.SetField(mod, "ver", lua.LString(version))
L.SetField(mod, "user", lua.LString(username)) L.SetField(mod, "user", lua.LString(curuser.Username))
L.SetField(mod, "host", lua.LString(host)) L.SetField(mod, "host", lua.LString(host))
L.SetField(mod, "home", lua.LString(homedir)) L.SetField(mod, "home", lua.LString(homedir))

View File

@ -40,8 +40,6 @@ var (
func main() { func main() {
homedir, _ = os.UserHomeDir() homedir, _ = os.UserHomeDir()
curuser, _ = user.Current() curuser, _ = user.Current()
preloadPath = strings.Replace(preloadPath, "~", homedir, 1)
sampleConfPath = strings.Replace(sampleConfPath, "~", homedir, 1)
if defaultConfDir == "" { if defaultConfDir == "" {
// we'll add *our* default if its empty (wont be if its changed comptime) // we'll add *our* default if its empty (wont be if its changed comptime)
@ -265,13 +263,12 @@ func fmtPrompt() string {
cwd, _ := os.Getwd() cwd, _ := os.Getwd()
cwd = strings.Replace(cwd, curuser.HomeDir, "~", 1) cwd = strings.Replace(cwd, curuser.HomeDir, "~", 1)
username := strings.Split(curuser.Username, "\\")[1] // for some reason Username includes the hostname on windows
args := []string{ args := []string{
"d", cwd, "d", cwd,
"D", filepath.Base(cwd), "D", filepath.Base(cwd),
"h", host, "h", host,
"u", username, "u", curuser.Username,
} }
for i, v := range args { for i, v := range args {

11
vars.go
View File

@ -3,7 +3,18 @@ package main
// String vars that are free to be changed at compile time // String vars that are free to be changed at compile time
var ( var (
version = "v0.5.1" version = "v0.5.1"
requirePaths = `';./libs/?/init.lua;./?/init.lua;./?/?.lua'
.. ';/usr/share/hilbish/libs/?/init.lua;'
.. ';/usr/share/hilbish/libs/?/?.lua;'
.. hilbish.home .. '/.local/share/hilbish/libs/?/init.lua;'
.. hilbish.home .. '/.local/share/hilbish/libs/?/?.lua;'
.. hilbish.home .. '/.local/share/hilbish/libs/?.lua'
.. hilbish.home .. '/.config/hilbish/?/init.lua'
.. hilbish.home .. '/.config/hilbish/?/?.lua'
.. hilbish.home .. '/.config/hilbish/?.lua'`
preloadPath = "/usr/share/hilbish/preload.lua"
defaultConfDir = "" // ~ will be substituted for home, path for user's default config defaultConfDir = "" // ~ will be substituted for home, path for user's default config
sampleConfPath = "/usr/share/hilbish/.hilbishrc.lua" // Path to default/sample config
prompt string // Prompt will always get changed anyway prompt string // Prompt will always get changed anyway
multilinePrompt = "> " multilinePrompt = "> "

View File

@ -1,18 +0,0 @@
// +build linux
package main
// String vars that are free to be changed at compile time
var (
requirePaths = `';./libs/?/init.lua;./?/init.lua;./?/?.lua'
.. ';/usr/share/hilbish/libs/?/init.lua;'
.. ';/usr/share/hilbish/libs/?/?.lua;'
.. hilbish.home .. '/.local/share/hilbish/libs/?/init.lua;'
.. hilbish.home .. '/.local/share/hilbish/libs/?/?.lua;'
.. hilbish.home .. '/.local/share/hilbish/libs/?.lua'
.. hilbish.home .. '/.config/hilbish/?/init.lua'
.. hilbish.home .. '/.config/hilbish/?/?.lua'
.. hilbish.home .. '/.config/hilbish/?.lua'`
preloadPath = "/usr/share/hilbish/preload.lua"
sampleConfPath = "/usr/share/hilbish/.hilbishrc.lua" // Path to default/sample config
)

View File

@ -1,12 +0,0 @@
// +build windows
package main
// String vars that are free to be changed at compile time
var (
requirePaths = `';./libs/?/init.lua;./?/init.lua;./?/?.lua'
.. hilbish.home .. '\\Appdata\\Roaming\\Hilbish\\libs\\?\\init.lua;'
.. hilbish.home .. '\\Appdata\\Roaming\\Hilbish\\libs\\?\\?.lua;'`
preloadPath = "~\\Appdata\\Roaming\\Hilbish\\preload.lua" // ~ and \ gonna cry?
sampleConfPath = "~\\Appdata\\Roaming\\Hilbish\\hilbishrc.lua" // Path to default/sample config
)