Initial commit to start things off.

master
Zed A. Shaw 3 days ago
commit f54ae6ebdf
  1. 29
      .gitignore
  2. 10
      README.md
  3. 35
      config/settings.go
  4. 5
      go.mod
  5. 2
      go.sum
  6. 9
      main.go

29
.gitignore vendored

@ -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

@ -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.

@ -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);
}
}

@ -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

@ -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=

@ -0,0 +1,9 @@
package main
import (
"fmt"
)
func main() {
fmt.Println("hi")
}
Loading…
Cancel
Save