Compare commits

..

No commits in common. "bbfe28dbae23bbf6257d9bfb0f8bc4c0975220b1" and "2b01d5edb27a4dedfebd5fcf31869a1b22aca08a" have entirely different histories.

3 changed files with 9 additions and 15 deletions

View File

@ -8,9 +8,9 @@ function doPrompt(fail)
))
end
print(ansikit.format('Welcome to {magenta}Hilbish{reset}, {cyan}' ..
os.getenv 'USER' .. '{reset}.\n' ..
'The nice lil shell for {blue}Lua{reset} fanatics!\n'))
print(ansikit.format('Welcome {cyan}'.. os.getenv 'USER' ..
'{reset} to {magenta}Hilbish{reset},\n' ..
'the nice lil shell for {blue}Lua{reset} fanatics!\n'))
doPrompt()

5
lua.go
View File

@ -17,7 +17,7 @@ prompt(ansikit.format(
))
`
func LuaInit(confpath string) {
func LuaInit() {
l = lua.NewState()
l.OpenLibs()
@ -60,8 +60,9 @@ func LuaInit(confpath string) {
}
}
homedir, _ := os.UserHomeDir()
// Run config
err = l.DoFile(confpath)
err = l.DoFile(homedir + "/.hilbishrc.lua")
if err != nil {
fmt.Fprintln(os.Stderr, err,
"\nAn error has occured while loading your config! Falling back to minimal default config.\n")

13
main.go
View File

@ -31,9 +31,6 @@ var bait hooks.Bait
var homedir string
func main() {
homedir, _ = os.UserHomeDir()
defaultconfpath := homedir + "/.hilbishrc.lua"
parser := argparse.NewParser("hilbish", "A shell for lua and flower lovers")
verflag := parser.Flag("v", "version", &argparse.Options{
Required: false,
@ -43,11 +40,6 @@ func main() {
Required: false,
Help: "Sets $SHELL to Hilbish's executed path",
})
configflag := parser.String("C", "config", &argparse.Options{
Required: false,
Help: "Sets the path to Hilbish's config",
Default: defaultconfpath,
})
err := parser.Parse(os.Args)
// If invalid flags or --help/-h,
@ -65,8 +57,9 @@ func main() {
// Set $SHELL if the user wants to
if *setshflag { os.Setenv("SHELL", os.Args[0]) }
homedir, _ = os.UserHomeDir()
// If user's config doesn't exixt,
if _, err := os.Stat(defaultconfpath); os.IsNotExist(err) {
if _, err := os.Stat(homedir + "/.hilbishrc.lua"); os.IsNotExist(err) {
// Read default from current directory
// (this is assuming the current dir is Hilbish's git)
input, err := os.ReadFile(".hilbishrc.lua")
@ -90,7 +83,7 @@ func main() {
}
HandleSignals()
LuaInit(*configflag)
LuaInit()
readline.Completer = readline.FilenameCompleter
readline.LoadHistory(homedir + "/.hilbish-history")