X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/d9fddc0f506eb4ead7049f5638674b2b8773fcaa..ae8532ff0e9d3d676fec5f48780a62e58aa6882d:/main.go?ds=sidebyside diff --git a/main.go b/main.go index e25e7f3..a73407f 100644 --- a/main.go +++ b/main.go @@ -20,11 +20,15 @@ Commands: -n print the plan without model calls login log in to ChatGPT with a device code probe LOG COUNT [BUILDS] measure the compactor on a log, with real calls + version show the build version help show this help Chat needs a running daemon. ONECHAT_DIR sets the data directory. ` +// version is set by the package build and stays dev for direct Go builds. +var version = "dev" + func main() { err := run() if err != nil { @@ -44,11 +48,17 @@ func run() error { if err != nil { return fmt.Errorf("write command help: %w", err) } + case len(args) == 1 && args[0] == "version": + _, err := fmt.Println(version) + if err != nil { + return fmt.Errorf("write build version: %w", err) + } case len(args) == 1 && args[0] == "login": err := chatgptLogin(ctx, os.Stdout) if err != nil { return err } + // A signal is the normal stop of the daemon and the client, so their // result does not include ctx.Err(). case len(args) == 1 && args[0] == "daemon":