feat: Allow starting CLI without initial prompt (#2)
Make the initial prompt optional. When no arguments are provided, the CLI now goes directly to interactive mode instead of exiting. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
63d4ad95d0
commit
981683a405
1 changed files with 26 additions and 29 deletions
9
main.go
9
main.go
|
|
@ -178,12 +178,8 @@ func main() {
|
||||||
logFilePath = filepath.Join(stateDir, "klod", "sessions", sessionTime+".log")
|
logFilePath = filepath.Join(stateDir, "klod", "sessions", sessionTime+".log")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get initial prompt from command-line arguments
|
// Get initial prompt from command-line arguments (if provided)
|
||||||
if len(os.Args) < 2 {
|
if len(os.Args) >= 2 {
|
||||||
fmt.Fprintln(os.Stderr, "Usage: klod <your prompt>")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
initialPrompt := strings.Join(os.Args[1:], " ")
|
initialPrompt := strings.Join(os.Args[1:], " ")
|
||||||
|
|
||||||
// Add initial user message to conversation history
|
// Add initial user message to conversation history
|
||||||
|
|
@ -211,6 +207,7 @@ func main() {
|
||||||
}
|
}
|
||||||
conversationHistory = append(conversationHistory, assistantMsg)
|
conversationHistory = append(conversationHistory, assistantMsg)
|
||||||
logConversation(assistantMsg)
|
logConversation(assistantMsg)
|
||||||
|
}
|
||||||
|
|
||||||
// Interactive conversation loop
|
// Interactive conversation loop
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue