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:
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/versenilvis/iris/config"
|
||||
)
|
||||
|
||||
var initCmd = &cobra.Command{
|
||||
@@ -120,6 +121,61 @@ var setupCmd = &cobra.Command{
|
||||
fmt.Printf("✓ Added iris integration to %s\n", configFile)
|
||||
}
|
||||
|
||||
// initialize default config file if it does not exist
|
||||
if path, err := config.ConfigPath(); err == nil {
|
||||
if _, statErr := os.Stat(path); os.IsNotExist(statErr) {
|
||||
_ = os.MkdirAll(filepath.Dir(path), 0755)
|
||||
defaultContent := `# ~/.config/iris/config.toml
|
||||
# iris configuration file
|
||||
|
||||
[core]
|
||||
# schema version
|
||||
# do not edit this field manually
|
||||
version = 1
|
||||
|
||||
# override shell: "bash", "zsh", "fish", keep empty for auto detection
|
||||
shell = ""
|
||||
|
||||
# startup mode: "last", "spec", "history"
|
||||
# "last" = remember last mode used
|
||||
mode = "last"
|
||||
|
||||
# enable debug logging
|
||||
debug = false
|
||||
|
||||
[ui]
|
||||
# enable inline ghost text
|
||||
ghost-text = true
|
||||
|
||||
# maximum suggestions to display
|
||||
max-suggestions = 100
|
||||
|
||||
# maximum height of the overlay
|
||||
max-height = 15
|
||||
|
||||
[git]
|
||||
# hide current branch in checkout/switch list
|
||||
filter-active-branch = true
|
||||
|
||||
# merge remote and local branches with same name
|
||||
deduplicate-branches = true
|
||||
|
||||
[updater]
|
||||
# check for updates on startup
|
||||
check-on-startup = true
|
||||
|
||||
# update channel: "stable", "nightly"
|
||||
channel = "stable"
|
||||
|
||||
# interval between update checks, e.g. "24h", "6h", "30m"
|
||||
check-interval = "24h"
|
||||
`
|
||||
if errWrite := os.WriteFile(path, []byte(defaultContent), 0644); errWrite == nil {
|
||||
fmt.Printf("✓ Initialized default config file at %s\n", path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("\nSetup complete! Please restart your terminal or run:")
|
||||
fmt.Printf(" source %s\n", configFile)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user