aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_go2work.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/c_go2work.go')
-rw-r--r--src/c_go2work.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/c_go2work.go b/src/c_go2work.go
index 5dc460c..920c9bf 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
- * Wed Mar 30 13:20:26 CEST 2022
+ * Fri Apr 1 17:03:18 CEST 2022
* Joe
*
* The main.
@@ -60,6 +60,7 @@ func main() {
var curr_t [3]byte
var dest_t [3]byte
var tmp int
+ var options options
log.SetPrefix(PROGNAME + ": ")
log.SetFlags(0)
if len(os.Args[0:]) == 1 {
@@ -89,17 +90,18 @@ func main() {
dest_t[MINS] = byte(tmp)
dest_t[SECS] = 0
}
- if check_media_player(DEF_MEDIA_PLAYER) == false {
- log.Fatal("media player (" + DEF_MEDIA_PLAYER + ") not found")
- return
- }
- if DEF_USE_FORTUNE == true && check_fortune() == false {
- fmt.Println("Beware, fortune is set on but was not found")
- }
+ options = parse_options()
if check_time_format(dest_t) == false {
log.Fatal(LOG_FORMAT)
return
}
+ if check_media_player(options.media_player) == false {
+ log.Fatal("media player (" + options.media_player + ") not found")
+ return
+ }
+ if options.use_fortune == true && check_fortune() == false {
+ fmt.Println("Beware, fortune is set on but was not found")
+ }
curr_t = get_time()
print_time_left(curr_t, dest_t)
ticker := time.NewTicker(INTERVAL * time.Millisecond)
@@ -114,8 +116,8 @@ func main() {
curr_t[SECS] == dest_t[SECS] {
args := append(DEF_PLAYER_OPTIONS(), DEF_FILES()[0])
exec_player(
- DEF_USE_FORTUNE,
- DEF_MEDIA_PLAYER,
+ options.use_fortune,
+ options.media_player,
args...,
)
return