summary refs log tree commit diff stats
path: root/cmd/cetus-nasa
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/cetus-nasa')
-rw-r--r--cmd/cetus-nasa/cetus-nasa.go33
1 files changed, 21 insertions, 12 deletions
diff --git a/cmd/cetus-nasa/cetus-nasa.go b/cmd/cetus-nasa/cetus-nasa.go
index 96b83fc..7eb80c2 100644
--- a/cmd/cetus-nasa/cetus-nasa.go
+++ b/cmd/cetus-nasa/cetus-nasa.go
@@ -20,12 +20,14 @@ import (
 	"log"
 	"time"
 
-	"framagit.org/andinus/cetus/pkg"
+	"framagit.org/andinus/cetus/pkg/background"
+	"framagit.org/andinus/cetus/pkg/cetus"
 	"framagit.org/andinus/cetus/pkg/nasa"
 )
 
 var (
 	quiet     bool
+	version   bool
 	fetchOnly bool
 
 	api         string
@@ -38,19 +40,13 @@ var (
 )
 
 func main() {
-	var (
-		picturePath string
-		apodRes     nasa.APOD
-		err         error
-		apodInfo    map[string]string
-	)
-
-	dateHelp = fmt.Sprintf("Choose a random date between 1995-06-16 & %s",
-		time.Now().UTC().Format("2006-01-02"))
-	dateDefault = time.Now().UTC().Format("2006-01-02")
-
 	parseFlags()
 
+	if version {
+		cetus.Version()
+		return
+	}
+
 	// Convert timeout to seconds
 	timeout = timeout * time.Second
 
@@ -58,6 +54,13 @@ func main() {
 		date = nasa.RandDate()
 	}
 
+	var (
+		picturePath string
+		apodRes     nasa.APOD
+		err         error
+		apodInfo    map[string]string
+	)
+
 	apodInfo = make(map[string]string)
 	apodInfo["api"] = api
 	apodInfo["apiKey"] = apiKey
@@ -92,11 +95,17 @@ func main() {
 
 func parseFlags() {
 	flag.BoolVar(&quiet, "quiet", false, "No output")
+	flag.BoolVar(&version, "version", false, "Cetus version")
 	flag.BoolVar(&fetchOnly, "fetch-only", false, "Don't set background, only fetch info")
+
+	dateHelp = fmt.Sprintf("Choose a random date between 1995-06-16 & %s",
+		time.Now().UTC().Format("2006-01-02"))
 	flag.BoolVar(&random, "random", false, dateHelp)
 
 	flag.StringVar(&api, "api", "https://api.nasa.gov/planetary/apod", "APOD API URL")
 	flag.StringVar(&apiKey, "api-key", "DEMO_KEY", "api.nasa.gov key for expanded usage")
+
+	dateDefault = time.Now().UTC().Format("2006-01-02")
 	flag.StringVar(&date, "date", dateDefault, "Date of the APOD image to retrieve")
 
 	flag.DurationVar(&timeout, "timeout", 32*time.Second, "Timeout for http client in seconds")
type can be fully generic!' href='/akkartik/mu/commit/063list.mu?h=hlt&id=4c3e1f0780da52c72be467c6bfd3b2073ce57190'>4c3e1f07 ^
77d5b5d6 ^
4c3e1f07 ^

87ef6a67 ^


4c3e1f07 ^
77d5b5d6 ^
4c3e1f07 ^



87ef6a67 ^

687dd3f5 ^
4c3e1f07 ^







87ef6a67 ^







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53