aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2022-04-01 17:16:12 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2022-04-01 17:16:12 +0200
commit93620443da0307626ff7a29d9eeff70079c1a192 (patch)
tree682fea1f3678c64ef2b9099952acb63bdf0528bd
parentNew file, still progressing (diff)
downloadgo2work-93620443da0307626ff7a29d9eeff70079c1a192.tar.gz
go2work-93620443da0307626ff7a29d9eeff70079c1a192.tar.bz2
go2work-93620443da0307626ff7a29d9eeff70079c1a192.tar.xz
go2work-93620443da0307626ff7a29d9eeff70079c1a192.tar.zst
go2work-93620443da0307626ff7a29d9eeff70079c1a192.zip
Set up default options, now going for random and true parse
-rw-r--r--src/c_defs.go4
-rw-r--r--src/c_go2work.go3
-rw-r--r--src/p_options.go17
3 files changed, 18 insertions, 6 deletions
diff --git a/src/c_defs.go b/src/c_defs.go
index 9e9feef..4a4dc59 100644
--- a/src/c_defs.go
+++ b/src/c_defs.go
@@ -39,7 +39,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* go2work: src/c_defs.go
- * Wed Mar 30 13:33:39 CEST 2022
+ * Fri Apr 1 17:11:48 CEST 2022
* Joe
*
* Definitions.
@@ -74,7 +74,7 @@ func DEF_PLAYER_OPTIONS() []string {
}
}
-type options struct {
+type Options struct {
files []string
media_player string
player_options []string
diff --git a/src/c_go2work.go b/src/c_go2work.go
index 920c9bf..faca5a3 100644
--- a/src/c_go2work.go
+++ b/src/c_go2work.go
@@ -60,7 +60,7 @@ func main() {
var curr_t [3]byte
var dest_t [3]byte
var tmp int
- var options options
+ var options Options
log.SetPrefix(PROGNAME + ": ")
log.SetFlags(0)
if len(os.Args[0:]) == 1 {
@@ -114,6 +114,7 @@ func main() {
if curr_t[HOURS] == dest_t[HOURS] &&
curr_t[MINS] == dest_t[MINS] &&
curr_t[SECS] == dest_t[SECS] {
+ // implement random
args := append(DEF_PLAYER_OPTIONS(), DEF_FILES()[0])
exec_player(
options.use_fortune,
diff --git a/src/p_options.go b/src/p_options.go
index 44b67e9..8abd3c2 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 17:03:22 CEST 2022
+ * Fri Apr 1 17:16:04 CEST 2022
* Joe
*
* Options parsing.
@@ -47,7 +47,18 @@
package main
-func parse_options() options {
- var options options
+func parse_options() Options {
+ options := init_def_options()
+ return options
+}
+
+func init_def_options() Options {
+ options := Options{
+ files: DEF_FILES(),
+ media_player: DEF_MEDIA_PLAYER,
+ player_options: DEF_PLAYER_OPTIONS(),
+ random: DEF_RANDOM,
+ use_fortune: DEF_USE_FORTUNE,
+ }
return options
}