Enha: move flag parse into init
This commit is contained in:
8
bot.go
8
bot.go
@@ -6,6 +6,7 @@ import (
|
|||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gf-lt/config"
|
"gf-lt/config"
|
||||||
"gf-lt/models"
|
"gf-lt/models"
|
||||||
@@ -1724,6 +1725,13 @@ func init() {
|
|||||||
// atomic default values
|
// atomic default values
|
||||||
cachedModelColor.Store("orange")
|
cachedModelColor.Store("orange")
|
||||||
go chatWatcher(ctx)
|
go chatWatcher(ctx)
|
||||||
|
// parse flags
|
||||||
|
flag.BoolVar(&cfg.CLIMode, "cli", false, "Run in CLI mode without TUI")
|
||||||
|
flag.BoolVar(&cfg.ToolUse, "tools", true, "run with tools")
|
||||||
|
flag.StringVar(&cliCardPath, "card", "", "Path to syscard JSON file")
|
||||||
|
flag.BoolVar(&cliContinue, "continue", false, "Continue from last chat (by agent or card)")
|
||||||
|
flag.StringVar(&cliMsg, "msg", "", "Send message and exit (one-shot mode)")
|
||||||
|
flag.Parse()
|
||||||
if !cfg.CLIMode {
|
if !cfg.CLIMode {
|
||||||
initTUI()
|
initTUI()
|
||||||
}
|
}
|
||||||
|
|||||||
7
main.go
7
main.go
@@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"gf-lt/models"
|
"gf-lt/models"
|
||||||
"gf-lt/pngmeta"
|
"gf-lt/pngmeta"
|
||||||
@@ -37,12 +36,6 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.BoolVar(&cfg.CLIMode, "cli", false, "Run in CLI mode without TUI")
|
|
||||||
flag.BoolVar(&cfg.ToolUse, "tools", true, "run with tools")
|
|
||||||
flag.StringVar(&cliCardPath, "card", "", "Path to syscard JSON file")
|
|
||||||
flag.BoolVar(&cliContinue, "continue", false, "Continue from last chat (by agent or card)")
|
|
||||||
flag.StringVar(&cliMsg, "msg", "", "Send message and exit (one-shot mode)")
|
|
||||||
flag.Parse()
|
|
||||||
if cfg.CLIMode {
|
if cfg.CLIMode {
|
||||||
runCLIMode()
|
runCLIMode()
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user