fix: #986 implement --version flag

This commit is contained in:
Eugen Eisler
2024-09-26 20:57:37 +02:00
parent dd83d7faca
commit ea323c12ff
5 changed files with 14 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ import (
)
// Cli Controls the cli. It takes in the flags and runs the appropriate functions
func Cli() (message string, err error) {
func Cli(version string) (message string, err error) {
var currentFlags *Flags
if currentFlags, err = Init(); err != nil {
// we need to reset error, because we don't want to show double help messages
@@ -20,6 +20,11 @@ func Cli() (message string, err error) {
return
}
if currentFlags.Version {
fmt.Println(version)
return
}
var homedir string
if homedir, err = os.UserHomeDir(); err != nil {
return

View File

@@ -45,6 +45,7 @@ type Flags struct {
ScrapeURL string `short:"u" long:"scrape_url" description:"Scrape website URL to markdown using Jina AI"`
ScrapeQuestion string `short:"q" long:"scrape_question" description:"Search question using Jina AI"`
Seed int `short:"e" long:"seed" description:"Seed to be used for LMM generation"`
Version bool `long:"version" description:"Print current version"`
}
// Init Initialize flags. returns a Flags struct and an error