summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-10 09:44:33 +0300
committerPaul Buetow <paul@buetow.org>2026-04-10 09:44:33 +0300
commit53ad6846aa7506b621cd38f4933442379638a01d (patch)
tree6509f105521c3506d9809c45313c069ff544bf37 /cmd
parent011dbec6252d5180d7dd6dde5872208128c40c18 (diff)
Add internal version package and -version CLI flag
Introduce Version constant (0.0.1) in internal/version.go and wire -version/-v in cmd/snonux to print it and exit successfully. Made-with: Cursor
Diffstat (limited to 'cmd')
-rw-r--r--cmd/snonux/main.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/snonux/main.go b/cmd/snonux/main.go
index d3f8064..a908ca3 100644
--- a/cmd/snonux/main.go
+++ b/cmd/snonux/main.go
@@ -16,6 +16,7 @@ import (
"path/filepath"
"strings"
+ "codeberg.org/snonux/snonux/internal"
"codeberg.org/snonux/snonux/internal/config"
"codeberg.org/snonux/snonux/internal/generator"
"codeberg.org/snonux/snonux/internal/processor"
@@ -36,6 +37,9 @@ func main() {
// Special theme value "random" picks a theme at random from the registry.
func parseFlags() (*config.Config, error) {
cfg := &config.Config{}
+ var showVersion bool
+ flag.BoolVar(&showVersion, "version", false, "print version and exit")
+ flag.BoolVar(&showVersion, "v", false, "print version and exit")
listThemes := flag.Bool("list-themes", false, "print all available theme names and exit")
flag.StringVar(&cfg.InputDir, "input", "./inbox", "directory containing new source files to process")
@@ -44,6 +48,11 @@ func parseFlags() (*config.Config, error) {
flag.StringVar(&cfg.Theme, "theme", "random", "visual theme name, or \"random\" to pick one at random")
flag.Parse()
+ if showVersion {
+ fmt.Println(version.Version)
+ os.Exit(0)
+ }
+
if *listThemes {
fmt.Println(strings.Join(generator.ListThemes(), "\n"))
os.Exit(0)