mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			9d69b63a0f
			...
			e34ab5314a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					e34ab5314a | ||
| 
						 | 
					0ae31123b9 | ||
| 
						 | 
					7a17d7931f | ||
| 
						 | 
					d4084a82ba | 
							
								
								
									
										7
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.go
									
									
									
									
									
								
							@ -44,7 +44,7 @@ func main() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// i honestly dont know what directories to use for this
 | 
						// i honestly dont know what directories to use for this
 | 
				
			||||||
	switch runtime.GOOS {
 | 
						switch runtime.GOOS {
 | 
				
			||||||
	case "linux":
 | 
						case "linux", "darwin":
 | 
				
			||||||
		userDataDir = getenv("XDG_DATA_HOME", curuser.HomeDir + "/.local/share")
 | 
							userDataDir = getenv("XDG_DATA_HOME", curuser.HomeDir + "/.local/share")
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		// this is fine on windows, dont know about others
 | 
							// this is fine on windows, dont know about others
 | 
				
			||||||
@ -56,7 +56,7 @@ func main() {
 | 
				
			|||||||
		defaultConfDir = filepath.Join(confDir, "hilbish")
 | 
							defaultConfDir = filepath.Join(confDir, "hilbish")
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// else do ~ substitution
 | 
							// else do ~ substitution
 | 
				
			||||||
		defaultConfDir = expandHome(defaultHistDir)
 | 
							defaultConfDir = filepath.Join(expandHome(defaultConfDir), "hilbish")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	defaultConfPath = filepath.Join(defaultConfDir, "init.lua")
 | 
						defaultConfPath = filepath.Join(defaultConfDir, "init.lua")
 | 
				
			||||||
	if defaultHistDir == "" {
 | 
						if defaultHistDir == "" {
 | 
				
			||||||
@ -275,8 +275,7 @@ func handleHistory(cmd string) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func expandHome(path string) string {
 | 
					func expandHome(path string) string {
 | 
				
			||||||
	homedir := curuser.HomeDir
 | 
						homedir := curuser.HomeDir
 | 
				
			||||||
 | 
						return strings.Replace(path, "~", homedir, 1)
 | 
				
			||||||
	return strings.Replace(defaultHistDir, "~", homedir, 1)
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func removeDupes(slice []string) []string {
 | 
					func removeDupes(slice []string) []string {
 | 
				
			||||||
 | 
				
			|||||||
@ -93,9 +93,9 @@ func DoFile(rtm *rt.Runtime, path string) error {
 | 
				
			|||||||
		buf = append(buf, line...)
 | 
							buf = append(buf, line...)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	chunk, err := rtm.CompileAndLoadLuaChunk(path, buf, rt.TableValue(rtm.GlobalEnv()))
 | 
						clos, err := rtm.LoadFromSourceOrCode(path, buf, "bt", rt.TableValue(rtm.GlobalEnv()), false)
 | 
				
			||||||
	if chunk != nil {
 | 
						if clos != nil {
 | 
				
			||||||
		_, err = rt.Call1(rtm.MainThread(), rt.FunctionValue(chunk))
 | 
							_, err = rt.Call1(rtm.MainThread(), rt.FunctionValue(clos))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return err
 | 
						return err
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								vars.go
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								vars.go
									
									
									
									
									
								
							@ -3,7 +3,6 @@ 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 = "v2.0.0"
 | 
						version = "v2.0.0"
 | 
				
			||||||
	defaultConfDir = "" // ~ will be substituted for home, path for user's default config
 | 
					 | 
				
			||||||
	defaultHistDir = ""
 | 
						defaultHistDir = ""
 | 
				
			||||||
	commonRequirePaths = "';./libs/?/init.lua;./?/init.lua;./?/?.lua'"
 | 
						commonRequirePaths = "';./libs/?/init.lua;./?/init.lua;./?/?.lua'"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -17,4 +17,5 @@ var (
 | 
				
			|||||||
	dataDir = "/usr/local/share/hilbish"
 | 
						dataDir = "/usr/local/share/hilbish"
 | 
				
			||||||
	preloadPath = dataDir + "/prelude/init.lua"
 | 
						preloadPath = dataDir + "/prelude/init.lua"
 | 
				
			||||||
	sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
 | 
						sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
 | 
				
			||||||
 | 
						defaultConfDir = getenv("XDG_CONFIG_HOME", "~/.config")
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
@ -17,4 +17,5 @@ var (
 | 
				
			|||||||
	dataDir = "/usr/share/hilbish"
 | 
						dataDir = "/usr/share/hilbish"
 | 
				
			||||||
	preloadPath = dataDir + "/prelude/init.lua"
 | 
						preloadPath = dataDir + "/prelude/init.lua"
 | 
				
			||||||
	sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
 | 
						sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
 | 
				
			||||||
 | 
						defaultConfDir = ""
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
@ -11,4 +11,5 @@ var (
 | 
				
			|||||||
	dataDir = "~\\Appdata\\Roaming\\Hilbish" // ~ and \ gonna cry?
 | 
						dataDir = "~\\Appdata\\Roaming\\Hilbish" // ~ and \ gonna cry?
 | 
				
			||||||
	preloadPath = dataDir + "\\prelude\\init.lua"
 | 
						preloadPath = dataDir + "\\prelude\\init.lua"
 | 
				
			||||||
	sampleConfPath = dataDir + "\\hilbishrc.lua" // Path to default/sample config
 | 
						sampleConfPath = dataDir + "\\hilbishrc.lua" // Path to default/sample config
 | 
				
			||||||
 | 
						defaultConfDir = ""
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user