-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (37 loc) · 1.06 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"fmt"
"os"
"github.com/spf13/pflag"
)
const versionString = "DescribeImage 1.3.2"
func main() {
var (
outputFile string
promptHeader string
wrapWidth int
showVersion bool
verbose bool
model string
)
pflag.BoolVarP(&verbose, "verbose", "V", false, "verbose output")
pflag.StringVarP(&model, "model", "m", "", "Specify the Ollama model to use")
pflag.StringVarP(&promptHeader, "prompt", "p", "Describe the following image(s):", "Provide a custom prompt header")
pflag.StringVarP(&outputFile, "output", "o", "", "Specify an output file")
pflag.IntVarP(&wrapWidth, "wrap", "w", 0, "Word wrap at specified width. Use '-1' for terminal width")
pflag.BoolVarP(&showVersion, "version", "v", false, "display version")
pflag.Parse()
if showVersion {
fmt.Println(versionString)
return
}
filenames := pflag.Args()
output, err := describeImages(promptHeader, model, outputFile, wrapWidth, filenames, verbose)
if err != nil {
fmt.Println("Error:", err)
os.Exit(1)
}
if output != "" {
fmt.Println(output)
}
}