feat: toml config support (#9)

## What's new
- TOML config support 
- add config init command to justfile
https://github.com/versenilvis/IRIS/pull/9/commits/a5bb6c23d74ca73385b3590d2eb275ce6429906b
- add copy binary file to local bin on reload
https://github.com/versenilvis/IRIS/pull/9/commits/4da3acdbc58c28f20fa0021d15fec82823ba392b
- init config on setup
https://github.com/versenilvis/IRIS/pull/9/commits/fb48b6bb832f38e24fab9211d92858bab9a58a07

## Fix
- add lsof to support macos because /proc filesystem is Linux-specific
and does not exist on macOS 0439d829573864fcf902fc4127f7d45384bfab01
- git push doesnt suggest current branch, fix
https://github.com/versenilvis/IRIS/pull/9/commits/b498532b401b764a4a1a2c70b3cb44b7caf72320
- use timeout context for lsof command in reload handler
https://github.com/versenilvis/IRIS/pull/9/commits/1a2baee951e6538a729da12aedfe53960e51102d
This commit is contained in:
VERSE
2026-05-30 22:05:06 +07:00
committed by GitHub
parent 8556fa626a
commit 3d76a3ee88
21 changed files with 1064 additions and 160 deletions
+8 -5
View File
@@ -11,7 +11,6 @@ import (
)
func TestWriteCrashLog(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "iris-test-*")
if err != nil {
t.Fatalf("failed to create temp dir: %v", err)
@@ -19,15 +18,18 @@ func TestWriteCrashLog(t *testing.T) {
defer os.RemoveAll(tmpDir)
origHome := os.Getenv("HOME")
origCache := os.Getenv("XDG_CACHE_HOME")
defer func() {
_ = os.Setenv("HOME", origHome)
_ = os.Setenv("XDG_CACHE_HOME", origCache)
}()
_ = os.Setenv("HOME", tmpDir)
_ = os.Setenv("XDG_CACHE_HOME", filepath.Join(tmpDir, ".cache"))
testErr := "test panic message"
root.WriteCrashLog(testErr)
dir := filepath.Join(tmpDir, ".iris", "crashes")
dir := filepath.Join(tmpDir, ".cache", "iris", "crashes")
files, err := os.ReadDir(dir)
if err != nil {
t.Fatalf("failed to read crashes dir: %v", err)
@@ -55,7 +57,6 @@ func TestWriteCrashLog(t *testing.T) {
}
func TestCrashLogCommand(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "iris-test-*")
if err != nil {
t.Fatalf("failed to create temp dir: %v", err)
@@ -63,10 +64,13 @@ func TestCrashLogCommand(t *testing.T) {
defer os.RemoveAll(tmpDir)
origHome := os.Getenv("HOME")
origCache := os.Getenv("XDG_CACHE_HOME")
defer func() {
_ = os.Setenv("HOME", origHome)
_ = os.Setenv("XDG_CACHE_HOME", origCache)
}()
_ = os.Setenv("HOME", tmpDir)
_ = os.Setenv("XDG_CACHE_HOME", filepath.Join(tmpDir, ".cache"))
var buf bytes.Buffer
root.CrashCmd.SetOut(&buf)
@@ -81,7 +85,6 @@ func TestCrashLogCommand(t *testing.T) {
root.WriteCrashLog("mock error")
buf.Reset()
root.CrashCmd.Run(root.CrashCmd, []string{})
// expect the output to contain crash_ and .log, which is the path of the new crash log file
if !strings.Contains(buf.String(), "crash_") || !strings.Contains(buf.String(), ".log") {
t.Errorf("expected crash log path, got: %q", buf.String())
}
@@ -93,7 +96,7 @@ func TestCrashLogCommand(t *testing.T) {
t.Errorf("expected 'crash log cleared', got: %q", buf.String())
}
dir := filepath.Join(tmpDir, ".iris", "crashes")
dir := filepath.Join(tmpDir, ".cache", "iris", "crashes")
if _, err := os.Stat(dir); !os.IsNotExist(err) {
t.Errorf("expected crashes directory to be deleted, but it exists")
}