Skip to content

Commit

Permalink
35: build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufcanb committed Feb 11, 2025
1 parent 08d3797 commit b93215b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pkg/app/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,25 @@ import (
"github.com/yusufcanb/tlm/pkg/shell"
)

func shouldCheckOllamaIsSetandUp(commandName string) bool {
switch commandName {
case "ask", "a", "explain", "e", "suggest", "s":
return true
default:
return false
}
}

func notFound(_ *cli.Context, _ string) {
fmt.Println(shell.Err() + " command not found.")
os.Exit(-1)
}

func beforeRun(o *ollama.Client) func(c *cli.Context) error {

// fmt.Println("----DEBUG----")
// fmt.Println(strings.Join(os.Args, " "))
// fmt.Println("----DEBUG----")

return func(c *cli.Context) error {
arg := c.Args().Get(0)

// If the command is not help or version, check if Ollama is set and up
if arg != "v" || arg != "version" || arg != "help" || arg != "h" {
if shouldCheckOllamaIsSetandUp(arg) {
var err error

err = shell.CheckOllamaIsSet()
Expand Down

0 comments on commit b93215b

Please sign in to comment.