start beta versioning

This commit is contained in:
2025-12-16 18:41:38 -05:00
parent 10da72a1f6
commit e2c6f15e5b
3 changed files with 28 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ import (
"fes/src/doc" "fes/src/doc"
"fes/src/new" "fes/src/new"
"fes/src/server" "fes/src/server"
"fes/src/version"
) )
//go:embed core/* //go:embed core/*
@@ -38,8 +39,14 @@ func main() {
fmt.Println("Options:") fmt.Println("Options:")
flag.PrintDefaults() flag.PrintDefaults()
} }
showVersion := flag.Bool("version", false, "Show version and exit")
flag.Parse() flag.Parse()
if *showVersion {
version.Version()
}
if *config.Color { if *config.Color {
color.NoColor = true color.NoColor = true
} }

View File

@@ -2,10 +2,12 @@ package ui
import ( import (
"errors" "errors"
"fes/src/config"
"fmt" "fmt"
"strings" "strings"
"fes/src/config"
"fes/src/version"
"github.com/fatih/color" "github.com/fatih/color"
) )
@@ -28,17 +30,17 @@ func Path(path string, err error) {
} }
func Warning(msg string, err error) error { func Warning(msg string, err error) error {
fmt.Printf("fes: %s: %v\n", color.MagentaString("warning"), err) fmt.Printf("%s: %s: %v\n", version.PROGRAM_NAME, color.MagentaString("warning"), err)
return err return err
} }
func Error(msg string, err error) error { func Error(msg string, err error) error {
fmt.Printf("fes: %s: %v\n", color.RedString("error"), err) fmt.Printf("%s: %s: %v\n", version.PROGRAM_NAME, color.RedString("error"), err)
return err return err
} }
func Fatal(msg string, err error) error { func Fatal(msg string, err error) error {
fmt.Printf("fes: %s: %v\n", color.RedString("fatal"), err) fmt.Printf("%s: %s: %v\n", version.PROGRAM_NAME, color.RedString("fatal"), err)
panic(err) panic(err)
} }

15
src/version/version.go Normal file
View File

@@ -0,0 +1,15 @@
package version
import (
"fmt"
"os"
)
const PROGRAM_NAME string = "fes"
const PROGRAM_NAME_LONG string = "fes/fSD"
const VERSION string = "beta"
func Version() {
fmt.Printf("%s version %s\n", PROGRAM_NAME_LONG, VERSION)
os.Exit(0)
}