commit f54ae6ebdf99510c30fd7644bbb281e2f420da86 Author: Zed A. Shaw Date: Mon Sep 8 22:38:04 2025 -0400 Initial commit to start things off. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c9db0f --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +# ---> Vim +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +backup +*.exe +*.dll +coverage +coverage/* +.venv +*.gz +public diff --git a/README.md b/README.md new file mode 100644 index 0000000..fd08e7b --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# Ozai the Air Killer + +Ozai just does the minimal thing you want in a process watcher/restarter: + +1. Start thing. +2. Watch thing. +3. Restart thing. + +No random ass Hugo includes. No forced upgrades to the latest possible Go. No randomly included +entire web interfaces for no reason. Just the simplest thing needed for the task and no more. diff --git a/config/settings.go b/config/settings.go new file mode 100644 index 0000000..6ed6eed --- /dev/null +++ b/config/settings.go @@ -0,0 +1,35 @@ +package config + +import ( + "flag" + "log" + "github.com/BurntSushi/toml" +) + +type config struct { + Test int + ConfigPath string +} + +var Settings config + +func parseFlags(c *config) { + flag.StringVar(&c.ConfigPath, "config", ".ozai.toml", ".ozai.toml to load") + flag.Parse() +} + +func Load() { + parseFlags(&Settings) + + metadata, err := toml.DecodeFile(Settings.ConfigPath, &Settings) + + if err != nil { + log.Fatalf("error loading config.toml: %v", err) + } + + bad_keys := metadata.Undecoded() + + if len(bad_keys) > 0 { + log.Fatalf("unknown configuration keys: %v", bad_keys); + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..bf92aef --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module lcthw.dev/learn-code-the-hard-way/ozai + +go 1.24.2 + +require github.com/BurntSushi/toml v1.5.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..ff7fd09 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= +github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= diff --git a/main.go b/main.go new file mode 100644 index 0000000..b6ce0ac --- /dev/null +++ b/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("hi") +}