From 701b83eda4bdad75417be201d101f988ced4d6be Mon Sep 17 00:00:00 2001 From: Alexandre Date: Wed, 29 Jan 2025 08:50:16 +0100 Subject: [PATCH] Started creating the history system --- conf.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 conf.go diff --git a/conf.go b/conf.go new file mode 100644 index 0000000..0340af8 --- /dev/null +++ b/conf.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "os" +) + +func main() { + homeDir, err := os.UserHomeDir() + if err != nil { + return + } + if fileExists(homeDir+"/.gosh_history") { + fmt.Println("GoSh History file exists") + } else { + fmt.Println("GoSh History file does not exist") + } +} + +func fileExists(filename string) bool { + info, err := os.Stat(filename) + if os.IsNotExist(err) { + return false + } + return !info.IsDir() +}