11package main
22
33import (
4- "flag"
54 "fmt"
65 "os"
76
@@ -17,51 +16,6 @@ var version = "0.0.2.3"
1716var buildNumber = "dev"
1817
1918func main () {
20- // Define CLI flags
21- workspaceDir := flag .String ("workspace" , "" , "Workspace directory for file operations (default: ~/ti-workspace)" )
22- ollamaURL := flag .String ("ollama" , "" , "Ollama API URL (default: http://localhost:11434)" )
23- geminiAPIKey := flag .String ("gemini" , "" , "Gemini API key (use this to enable Gemini instead of Ollama)" )
24- model := flag .String ("model" , "" , "Default model to use (default: llama2 for Ollama, gemini-2.0-flash-exp for Gemini)" )
25- showVersion := flag .Bool ("version" , false , "Show version information" )
26- showHelp := flag .Bool ("help" , false , "Show help information" )
27-
28- flag .Parse ()
29-
30- // Show version
31- if * showVersion {
32- fmt .Printf ("Terminal Intelligence (TI) version %s\n " , version )
33- os .Exit (0 )
34- }
35-
36- // Show help
37- if * showHelp {
38- fmt .Println ("Terminal Intelligence (TI) - CLI-based IDE with AI assistance" )
39- fmt .Println ()
40- fmt .Println ("Usage:" )
41- fmt .Printf (" %s [options]\n " , os .Args [0 ])
42- fmt .Println ()
43- fmt .Println ("Options:" )
44- flag .PrintDefaults ()
45- fmt .Println ()
46- fmt .Println ("Examples:" )
47- fmt .Println (" # Use Ollama (default)" )
48- fmt .Println (" ./ti -model qwen2.5-coder:1.5b -ollama http://localhost:11434 -workspace ~/ti-workspace" )
49- fmt .Println ()
50- fmt .Println (" # Use Gemini" )
51- fmt .Println (" ./ti -model gemini-2.0-flash-exp -gemini YOUR_API_KEY -workspace ~/ti-workspace" )
52- fmt .Println ()
53- fmt .Println ("Keyboard Shortcuts:" )
54- fmt .Println (" Tab - Switch between editor and AI pane" )
55- fmt .Println (" Ctrl+S - Save current file" )
56- fmt .Println (" Ctrl+R - Execute current script" )
57- fmt .Println (" Ctrl+K - Kill running process (in terminal mode)" )
58- fmt .Println (" Ctrl+Enter - Send message to AI" )
59- fmt .Println (" Ctrl+C - Copy selected line or AI block" )
60- fmt .Println (" Ctrl+Q - Quit application" )
61- fmt .Println ()
62- os .Exit (0 )
63- }
64-
6519 // Load configuration
6620 appCfg := types .DefaultConfig ()
6721
@@ -89,40 +43,21 @@ func main() {
8943 createdPath , err := config .CreateDefaultConfig ()
9044 if err != nil {
9145 fmt .Fprintf (os .Stderr , "Warning: Could not create default config file: %v\n " , err )
92- fmt .Fprintf (os .Stderr , "Continuing with command-line flags and defaults...\n " )
46+ fmt .Fprintf (os .Stderr , "Continuing with defaults...\n " )
9347 } else {
9448 fmt .Fprintf (os .Stderr , "Created default config file at: %s\n " , createdPath )
9549 fmt .Fprintf (os .Stderr , "Edit this file to customize your settings.\n " )
9650 fmt .Fprintf (os .Stderr , "Continuing with defaults for this session...\n \n " )
9751 }
9852 }
9953
100- // Apply CLI flag overrides on top of config file (or defaults)
101- if * geminiAPIKey != "" {
102- appCfg .Provider = "gemini"
103- appCfg .GeminiAPIKey = * geminiAPIKey
104- if * model == "" {
105- appCfg .DefaultModel = "gemini-2.0-flash-exp"
106- }
107- }
108-
109- // Apply CLI overrides for Ollama URL if provided
110- if * ollamaURL != "" {
111- appCfg .OllamaURL = * ollamaURL
112- }
113-
114- if * workspaceDir != "" {
115- appCfg .WorkspaceDir = * workspaceDir
116- } else {
117- // Default workspace to current working directory
54+ // Default workspace to current working directory if not set
55+ if appCfg .WorkspaceDir == "" {
11856 cwd , err := os .Getwd ()
11957 if err == nil {
12058 appCfg .WorkspaceDir = cwd
12159 }
12260 }
123- if * model != "" {
124- appCfg .DefaultModel = * model
125- }
12661
12762 // Save updated workspace back to config.json
12863 jcfgToSave := config .AppConfigToJSONConfig (appCfg )
0 commit comments