diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | src/c_defs.go | 2 | ||||
-rw-r--r-- | src/c_go2work.go | 11 | ||||
-rw-r--r-- | src/p_options.go | 19 |
4 files changed, 23 insertions, 17 deletions
@@ -11,7 +11,7 @@ # ======================== # # go2work: Makefile -# Fri Apr 1 17:04:04 CEST 2022 +# Fri Apr 1 21:01:49 CEST 2022 # Joe # # GNU Makefile @@ -42,8 +42,10 @@ MKDIR = mkdir -p RMDIR = rmdir RM = rm -rf -build: +deps: go get github.com/BurntSushi/toml@latest + +build: go build -o ${TARGET} ${SRCS} clean: @@ -52,7 +54,7 @@ clean: run: go run ${SRCS} -.PHONY: build clean run +.PHONY: build clean run deps # File prefixes info # ------------------ diff --git a/src/c_defs.go b/src/c_defs.go index d21fa8a..06aa400 100644 --- a/src/c_defs.go +++ b/src/c_defs.go @@ -57,7 +57,7 @@ const ( LOG_FORMAT = "bad time format" OPTIONS_FILE = PROGNAME + "/" + PROGNAME + ".toml" DEF_MEDIA_PLAYER = "mpv" - DEF_RANDOM = true + DEF_RANDOM = false DEF_USE_FORTUNE = true ) diff --git a/src/c_go2work.go b/src/c_go2work.go index c6ec7af..3a58f02 100644 --- a/src/c_go2work.go +++ b/src/c_go2work.go @@ -39,7 +39,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * go2work: src/c_go2work.go - * Fri Apr 1 18:36:54 CEST 2022 + * Fri Apr 1 21:07:42 CEST 2022 * Joe * * The main. @@ -48,7 +48,6 @@ package main import ( - "fmt" "log" "os" "time" @@ -91,14 +90,6 @@ func main() { dest_t[SECS] = 0 } options = parse_options() - fmt.Println("OPTIONS") - fmt.Println("=======") - fmt.Println(options.files) - fmt.Println(options.media_player) - fmt.Println(options.player_options) - fmt.Println(options.random) - fmt.Println(options.use_fortune) - fmt.Println("=======\n") if check_time_format(dest_t) == false { log.Fatalln(LOG_FORMAT) return diff --git a/src/p_options.go b/src/p_options.go index ad35d24..99728d7 100644 --- a/src/p_options.go +++ b/src/p_options.go @@ -39,7 +39,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * go2work: src/p_options.go - * Fri Apr 1 19:44:09 CEST 2022 + * Fri Apr 1 21:13:50 CEST 2022 * Joe * * Options parsing. @@ -48,9 +48,10 @@ package main import ( - "github.com/BurntSushi/toml" + "fmt" "log" "os" + "github.com/BurntSushi/toml" ) func parse_options() Options { @@ -96,6 +97,18 @@ func find_options_file() string { func parse_toml_file(options_file string, def_options Options) Options { options := def_options - toml.DecodeFile(options_file, &options) + fmt.Println(options_file) + _, err := toml.DecodeFile(options_file, &options) + if err != nil { + log.Fatal(err) + } + fmt.Println("OPTIONS") + fmt.Println("=======") + fmt.Println(options.files) + fmt.Println(options.media_player) + fmt.Println(options.player_options) + fmt.Println(options.random) + fmt.Println(options.use_fortune) + fmt.Println("=======\n") return options } |