add selfnames to version file

This commit is contained in:
sentriz
2020-01-21 13:34:17 +00:00
parent 94b310b165
commit 2abd3cf70b
6 changed files with 19 additions and 19 deletions

View File

@@ -42,6 +42,10 @@ cat > version/version.go << EOL
package version package version
const NAME = "gonic"
const NAME_UPPER = "GONIC"
const NAME_EMBED = "gonicembed"
const NAME_SCAN = "gonicscan"
const VERSION = "$new_version" const VERSION = "$new_version"
EOL EOL

View File

@@ -60,7 +60,7 @@ var Bytes = map[string]*EmbeddedAsset{
0x6d,0x3e,0x0a,0x3c,0x2f,0x64,0x69,0x76,0x3e,0x0a,0x7b,0x7b,0x20,0x65,0x6e,0x64,0x20,0x7d,0x7d,0x0a, 0x6d,0x3e,0x0a,0x3c,0x2f,0x64,0x69,0x76,0x3e,0x0a,0x7b,0x7b,0x20,0x65,0x6e,0x64,0x20,0x7d,0x7d,0x0a,
}}, }},
"pages/home.tmpl": &EmbeddedAsset{ "pages/home.tmpl": &EmbeddedAsset{
ModTime: time.Unix(1574803343, 0), ModTime: time.Unix(1579270806, 0),
Bytes: []byte{ Bytes: []byte{
0x7b,0x7b,0x20,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x22,0x75,0x73,0x65,0x72,0x22,0x20,0x7d,0x7d,0x0a,0x3c,0x64,0x69,0x76, 0x7b,0x7b,0x20,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x22,0x75,0x73,0x65,0x72,0x22,0x20,0x7d,0x7d,0x0a,0x3c,0x64,0x69,0x76,
0x20,0x63,0x6c,0x61,0x73,0x73,0x3d,0x22,0x70,0x61,0x64,0x64,0x65,0x64,0x20,0x62,0x6f,0x78,0x22,0x3e,0x0a,0x20,0x20,0x20, 0x20,0x63,0x6c,0x61,0x73,0x73,0x3d,0x22,0x70,0x61,0x64,0x64,0x65,0x64,0x20,0x62,0x6f,0x78,0x22,0x3e,0x0a,0x20,0x20,0x20,
@@ -10701,7 +10701,7 @@ var Bytes = map[string]*EmbeddedAsset{
0x55,0x23,0xfe,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82, 0x55,0x23,0xfe,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
}}, }},
"static/main.css": &EmbeddedAsset{ "static/main.css": &EmbeddedAsset{
ModTime: time.Unix(1574803343, 0), ModTime: time.Unix(1579270806, 0),
Bytes: []byte{ Bytes: []byte{
0x3a,0x72,0x6f,0x6f,0x74,0x20,0x7b,0x0a,0x20,0x20,0x2d,0x2d,0x70,0x61,0x64,0x2d,0x73,0x69,0x7a,0x65,0x3a,0x20,0x31,0x2e, 0x3a,0x72,0x6f,0x6f,0x74,0x20,0x7b,0x0a,0x20,0x20,0x2d,0x2d,0x70,0x61,0x64,0x2d,0x73,0x69,0x7a,0x65,0x3a,0x20,0x31,0x2e,
0x37,0x35,0x72,0x65,0x6d,0x3b,0x0a,0x7d,0x0a,0x0a,0x2a,0x2c,0x20,0x73,0x70,0x61,0x6e,0x2c,0x20,0x64,0x69,0x76,0x2c,0x20, 0x37,0x35,0x72,0x65,0x6d,0x3b,0x0a,0x7d,0x0a,0x0a,0x2a,0x2c,0x20,0x73,0x70,0x61,0x6e,0x2c,0x20,0x64,0x69,0x76,0x2c,0x20,

View File

@@ -15,13 +15,8 @@ import (
"senan.xyz/g/gonic/version" "senan.xyz/g/gonic/version"
) )
const (
programName = "gonic"
programVar = "GONIC"
)
func main() { func main() {
set := flag.NewFlagSet(programName, flag.ExitOnError) set := flag.NewFlagSet(version.NAME, flag.ExitOnError)
listenAddr := set.String("listen-addr", "0.0.0.0:4747", "listen address (optional)") listenAddr := set.String("listen-addr", "0.0.0.0:4747", "listen address (optional)")
musicPath := set.String("music-path", "", "path to music") musicPath := set.String("music-path", "", "path to music")
dbPath := set.String("db-path", "gonic.db", "path to database (optional)") dbPath := set.String("db-path", "gonic.db", "path to database (optional)")
@@ -31,7 +26,7 @@ func main() {
if err := ff.Parse(set, os.Args[1:], if err := ff.Parse(set, os.Args[1:],
ff.WithConfigFileFlag("config-path"), ff.WithConfigFileFlag("config-path"),
ff.WithConfigFileParser(ff.PlainParser), ff.WithConfigFileParser(ff.PlainParser),
ff.WithEnvVarPrefix(programVar), ff.WithEnvVarPrefix(version.NAME_UPPER),
); err != nil { ); err != nil {
log.Fatalf("error parsing args: %v\n", err) log.Fatalf("error parsing args: %v\n", err)
} }

View File

@@ -11,6 +11,8 @@ import (
"github.com/peterbourgon/ff" "github.com/peterbourgon/ff"
"github.com/pkg/errors" "github.com/pkg/errors"
"senan.xyz/g/gonic/version"
) )
// once i had this written with ~100% text/template but it was very // once i had this written with ~100% text/template but it was very
@@ -18,8 +20,7 @@ import (
// but it's pretty fast. which i needed it to for live reloading stuff // but it's pretty fast. which i needed it to for live reloading stuff
const ( const (
programName = "gonicembed" byteCols = 24
byteCols = 24
// begin file template // begin file template
fileHeader = `// file generated with embed tool fileHeader = `// file generated with embed tool
@@ -122,7 +123,7 @@ func processAssets(c *config, files []string) error {
} }
func main() { func main() {
set := flag.NewFlagSet(programName, flag.ExitOnError) set := flag.NewFlagSet(version.NAME_EMBED, flag.ExitOnError)
outPath := set.String( outPath := set.String(
"out-path", "", "out-path", "",
"generated file's path (required)") "generated file's path (required)")

View File

@@ -10,15 +10,11 @@ import (
"senan.xyz/g/gonic/db" "senan.xyz/g/gonic/db"
"senan.xyz/g/gonic/scanner" "senan.xyz/g/gonic/scanner"
) "senan.xyz/g/gonic/version"
const (
programName = "gonicscan"
programVar = "GONIC"
) )
func main() { func main() {
set := flag.NewFlagSet(programName, flag.ExitOnError) set := flag.NewFlagSet(version.NAME_SCAN, flag.ExitOnError)
musicPath := set.String( musicPath := set.String(
"music-path", "", "music-path", "",
"path to music") "path to music")
@@ -26,7 +22,7 @@ func main() {
"db-path", "gonic.db", "db-path", "gonic.db",
"path to database (optional)") "path to database (optional)")
if err := ff.Parse(set, os.Args[1:], if err := ff.Parse(set, os.Args[1:],
ff.WithEnvVarPrefix(programVar), ff.WithEnvVarPrefix(version.NAME_UPPER),
); err != nil { ); err != nil {
log.Fatalf("error parsing args: %v\n", err) log.Fatalf("error parsing args: %v\n", err)
} }

View File

@@ -4,4 +4,8 @@
package version package version
const NAME = "gonic"
const NAME_UPPER = "GONIC"
const NAME_EMBED = "gonicembed"
const NAME_SCAN = "gonicscan"
const VERSION = "v0.4.3" const VERSION = "v0.4.3"