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
+28 -6
View File
@@ -7,6 +7,7 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"syscall"
@@ -18,6 +19,7 @@ import (
_ "github.com/versenilvis/iris/commands/runner"
_ "github.com/versenilvis/iris/commands/search"
_ "github.com/versenilvis/iris/commands/view"
"github.com/versenilvis/iris/config"
"golang.org/x/term"
)
@@ -44,12 +46,6 @@ It works exactly like coding editor suggestion menu drop down.`,
return
}
}
if debugMode {
f, _ := os.OpenFile("iris.log", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
debugLogger = f
core.DebugWriter = f
_, _ = fmt.Fprintf(debugLogger, "--- IRIS DEBUG LOG ---\n")
}
runWrapper()
},
}
@@ -61,6 +57,25 @@ It works exactly like coding editor suggestion menu drop down.`,
func init() {
rootCmd.PersistentFlags().StringVarP(&shellFlag, "shell", "s", "", "shell to use (bash, zsh, fish)")
rootCmd.PersistentFlags().BoolVarP(&debugMode, "debug", "d", false, "enable debug logging to iris.log")
rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
if shellFlag != "" {
config.Get().Core.Shell = shellFlag
}
if debugMode {
config.Get().Core.Debug = true
}
if config.Get().Core.Debug {
logDir, err := config.CachePath()
if err == nil {
_ = os.MkdirAll(logDir, 0755)
f, _ := os.OpenFile(filepath.Join(logDir, "iris.log"), os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
debugLogger = f
core.DebugWriter = f
_, _ = fmt.Fprintf(debugLogger, "--- IRIS DEBUG LOG ---\n")
}
}
}
}
func debugLog(format string, a ...any) {
@@ -186,6 +201,13 @@ func runOriginal() {
}
func Execute() {
_ = config.MigrateFromLegacyJSON()
cfg, err := config.Load()
if err != nil {
fmt.Fprintf(os.Stderr, "[IRIS] config error: %v\n", err)
}
config.Init(cfg)
if os.Getenv("IRIS_IS_CHILD") != "true" {
runWatchdog()
return