Skip to content

Commit

Permalink
fix: clean up commands
Browse files Browse the repository at this point in the history
  • Loading branch information
RoseSecurity committed Nov 3, 2024
1 parent 7cb0be6 commit bedf334
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions cmd/fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func Diagnose(cmd *cobra.Command, args []string) {
u.LogErrorAndExit(err)
}

if len(config) == 0 {
fmt.Fprintf(os.Stderr, "Error: configuration file is empty\n")
os.Exit(1)
}

// Generate a formatted prompt for the recommendations function
formattedPrompt := fmt.Sprintf(`Error detected in configuration file '%s':
Expand Down
4 changes: 1 addition & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"fmt"
"os"

"github.com/RoseSecurity/kuzco/internal"
tuiUtils "github.com/RoseSecurity/kuzco/internal/tui/utils"
Expand Down Expand Up @@ -48,8 +47,7 @@ func runAnalyzer(cmd *cobra.Command, args []string) {

// Validate that the specified model exists in Ollama
if err := internal.ValidateModel(model, addr); err != nil {
fmt.Fprintf(os.Stderr, "Model validation error: %v\n", err)
os.Exit(1)
u.LogErrorAndExit(err)
}
cmd.Help()
}
Expand Down
9 changes: 5 additions & 4 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/fatih/color"
"github.com/spf13/cobra"
"golang.org/x/mod/semver"
)

// Placeholder for builds
Expand All @@ -29,8 +30,8 @@ var versionCmd = &cobra.Command{
if err == nil && latestReleaseTag != "" {
latestRelease := strings.TrimPrefix(latestReleaseTag, "v")
currentRelease := strings.TrimPrefix(Version, "v")
if latestRelease > currentRelease {
updateTerramaid(latestRelease)
if semver.Compare(latestRelease, currentRelease) > 0 {
updateKuzco(latestRelease)
}
}
},
Expand Down Expand Up @@ -58,8 +59,8 @@ func latestRelease() (string, error) {
}

// Display out of date warning
func updateTerramaid(latestVersion string) {
func updateKuzco(latestVersion string) {
c1 := color.New(color.FgCyan)

c1.Println(fmt.Sprintf("\nYour version of Terramaid is out of date. The latest version is %s\n\n", latestVersion))
c1.Println(fmt.Sprintf("\nYour version of Kuzco is out of date. The latest version is %s\n\n", latestVersion))
}

0 comments on commit bedf334

Please sign in to comment.