Compare commits

...

1 Commits

Author SHA1 Message Date
Michael Yang
110b072200 chore: simplify runner.Execute 2026-01-20 13:27:31 -08:00
3 changed files with 9 additions and 37 deletions

View File

@@ -1958,7 +1958,7 @@ func NewCLI() *cobra.Command {
Use: "runner",
Hidden: true,
RunE: func(cmd *cobra.Command, args []string) error {
return runner.Execute(os.Args[1:])
return runner.Execute(os.Args[2:])
},
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
}

View File

@@ -1,15 +0,0 @@
package main
import (
"fmt"
"os"
"github.com/ollama/ollama/runner"
)
func main() {
if err := runner.Execute(os.Args[1:]); err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
os.Exit(1)
}
}

View File

@@ -7,26 +7,13 @@ import (
)
func Execute(args []string) error {
if args[0] == "runner" {
args = args[1:]
}
var newRunner bool
var imageRunner bool
if len(args) > 0 && args[0] == "--ollama-engine" {
args = args[1:]
newRunner = true
}
if len(args) > 0 && args[0] == "--image-engine" {
args = args[1:]
imageRunner = true
}
if imageRunner {
return imagerunner.Execute(args)
} else if newRunner {
return ollamarunner.Execute(args)
} else {
return llamarunner.Execute(args)
if len(args) > 0 {
switch args[0] {
case "--ollama-engine":
return ollamarunner.Execute(args[1:])
case "--image-engine":
return imagerunner.Execute(args[1:])
}
}
return llamarunner.Execute(args)
}