diff options
| author | adamdottv <[email protected]> | 2025-06-05 15:44:20 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-06-11 11:43:28 -0500 |
| commit | 95d5e1f2318e0c62f19196122fc2a448f1114cfd (patch) | |
| tree | 75369872d32e10896e9263ddbf32cf36e7e418ac /packages/tui/internal/app | |
| parent | 979bad3e64e3fff43d41094a79c73deb31e82ec8 (diff) | |
| download | opencode-95d5e1f2318e0c62f19196122fc2a448f1114cfd.tar.gz opencode-95d5e1f2318e0c62f19196122fc2a448f1114cfd.zip | |
wip: refactoring tui
Diffstat (limited to 'packages/tui/internal/app')
| -rw-r--r-- | packages/tui/internal/app/app.go | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/packages/tui/internal/app/app.go b/packages/tui/internal/app/app.go index 9ce5c2a66..cffc4b1cf 100644 --- a/packages/tui/internal/app/app.go +++ b/packages/tui/internal/app/app.go @@ -21,7 +21,6 @@ import ( type App struct { ConfigPath string Config *config.Config - Info *client.AppInfo Client *client.ClientWithResponses Provider *client.ProviderInfo Model *client.ProviderModel @@ -34,7 +33,14 @@ type App struct { completionDialogOpen bool } -func New(ctx context.Context, httpClient *client.ClientWithResponses) (*App, error) { +type AppInfo struct { + client.AppInfo + Version string +} + +var Info AppInfo + +func New(ctx context.Context, version string, httpClient *client.ClientWithResponses) (*App, error) { err := status.InitService() if err != nil { slog.Error("Failed to initialize status service", "error", err) @@ -43,6 +49,12 @@ func New(ctx context.Context, httpClient *client.ClientWithResponses) (*App, err appInfoResponse, _ := httpClient.PostAppInfoWithResponse(ctx) appInfo := appInfoResponse.JSON200 + Info = AppInfo{Version: version} + Info.Git = appInfo.Git + Info.Path = appInfo.Path + Info.Time = appInfo.Time + Info.User = appInfo.User + providersResponse, err := httpClient.PostProviderListWithResponse(ctx) if err != nil { return nil, err @@ -70,7 +82,7 @@ func New(ctx context.Context, httpClient *client.ClientWithResponses) (*App, err return nil, fmt.Errorf("no providers found") } - appConfigPath := filepath.Join(appInfo.Path.Config, "tui.toml") + appConfigPath := filepath.Join(Info.Path.Config, "tui.toml") appConfig, err := config.LoadConfig(appConfigPath) if err != nil { slog.Info("No TUI config found, using default values", "error", err) @@ -95,7 +107,6 @@ func New(ctx context.Context, httpClient *client.ClientWithResponses) (*App, err app := &App{ ConfigPath: appConfigPath, Config: appConfig, - Info: appInfo, Client: httpClient, Provider: currentProvider, Model: currentModel, |
