summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-19 08:10:21 -0600
committerJeff Carr <[email protected]>2024-02-19 08:10:21 -0600
commitcddced4bc8e963c9e5a2af17c8e024a52bbc3c90 (patch)
treedd1ea79c8b7e3fd2213e6319b3ae78a06a2d0441 /config.go
parentf4605dbbd165348362ea38b6313b0818196cc675 (diff)
compiles and runs. maybe it's a plugin? maybe not
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'config.go')
-rw-r--r--config.go47
1 files changed, 25 insertions, 22 deletions
diff --git a/config.go b/config.go
index da8313a..3c5fb11 100644
--- a/config.go
+++ b/config.go
@@ -1,6 +1,6 @@
package main
-/*
+/*
This simply parses the command line arguments using the default golang
package called 'flag'. This can be used as a simple template to parse
command line arguments in other programs.
@@ -10,11 +10,14 @@ package main
global variables
*/
-import "log"
-import "os"
-import "flag"
-import "fmt"
-import "github.com/gookit/config"
+import (
+ "flag"
+ "fmt"
+ "log"
+ "os"
+
+ "github.com/gookit/config"
+)
var customUsage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
@@ -23,27 +26,27 @@ var customUsage = func() {
fmt.Println("")
fmt.Println("EXAMPLES:")
fmt.Println("")
- fmt.Println(os.Args[0] + " --width 1024 --height 768 --drift .1 --filename shaders/seascape.glsl")
- fmt.Println(os.Args[0] + " --width 640 --height 480 --filename shaders/planetfall.glsl")
+ fmt.Println(os.Args[0] + " --width 1024 --height 768 --drift .1 --filename seascape.glsl")
+ fmt.Println(os.Args[0] + " --width 640 --height 480 --filename planetfall.glsl")
fmt.Println("")
}
func parseFlags() {
- var version string
- var race bool
- var filename string
- var width int
- var height int
- var glDrift float64
+ var version string
+ var race bool
+ var filename string
+ var width int
+ var height int
+ var glDrift float64
- flag.StringVar (&version, "version", "v0.1", "Set compiled in version string")
+ flag.StringVar(&version, "version", "v0.1", "Set compiled in version string")
- flag.StringVar (&filename, "filename", "shaders/seascape.glsl", "path to GLSL file")
- flag.IntVar (&width, "width", 1024, "Width of the OpenGL Window")
- flag.IntVar (&height, "height", 768, "Height of the OpenGL Window")
+ flag.StringVar(&filename, "filename", "seascape.glsl", "path to GLSL file")
+ flag.IntVar(&width, "width", 1024, "Width of the OpenGL Window")
+ flag.IntVar(&height, "height", 768, "Height of the OpenGL Window")
- flag.Float64Var (&glDrift, "drift", 0.01, "Speed of the gradual camera drift")
- flag.BoolVar (&race, "race", race, "Use race detector")
+ flag.Float64Var(&glDrift, "drift", 0.01, "Speed of the gradual camera drift")
+ flag.BoolVar(&race, "race", race, "Use race detector")
// Set the output if something fails to stdout rather than stderr
flag.CommandLine.SetOutput(os.Stdout)
@@ -60,8 +63,8 @@ func parseFlags() {
// keys := []string{"filename", "width", "height", "drift"}
// keys := []string{"width", "height", "drift"}
-// keys := []string{"height"}
-// config.LoadFlags(keys)
+ // keys := []string{"height"}
+ // config.LoadFlags(keys)
config.Set("width", width)
config.Set("height", height)