summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-04-24 19:52:18 +0530
committerAndinus <andinus@nand.sh>2020-04-24 19:52:18 +0530
commit53d4a70ed2d1db9e7ebb98ec734d414539a74fc8 (patch)
tree521d3f87c08cc695d4207b1925f0de17f416a3ff
parenta01ce7b96892849d91911a2ef143a08b8e4e57c5 (diff)
downloadcetus-53d4a70ed2d1db9e7ebb98ec734d414539a74fc8.tar.gz
Move app func to main
-rw-r--r--apod.go (renamed from cmd/cetus/apod.go)0
-rw-r--r--bpod.go (renamed from cmd/cetus/bpod.go)0
-rw-r--r--env.go (renamed from cmd/cetus/env.go)0
-rw-r--r--main.go (renamed from cmd/cetus/main.go)33
-rw-r--r--parseargs.go (renamed from cmd/cetus/app.go)29
-rw-r--r--usage.go (renamed from cmd/cetus/usage.go)0
6 files changed, 32 insertions, 30 deletions
diff --git a/cmd/cetus/apod.go b/apod.go
index 2c0f2a0..2c0f2a0 100644
--- a/cmd/cetus/apod.go
+++ b/apod.go
diff --git a/cmd/cetus/bpod.go b/bpod.go
index 7aa0a1b..7aa0a1b 100644
--- a/cmd/cetus/bpod.go
+++ b/bpod.go
diff --git a/cmd/cetus/env.go b/env.go
index 9288c35..9288c35 100644
--- a/cmd/cetus/env.go
+++ b/env.go
diff --git a/cmd/cetus/main.go b/main.go
index b8098be..dfe208c 100644
--- a/cmd/cetus/main.go
+++ b/main.go
@@ -2,14 +2,45 @@ package main
 
 import (
 	"log"
+	"os"
 
 	"tildegit.org/andinus/cetus/cache"
 	"tildegit.org/andinus/lynx"
 )
 
+var (
+	version string = "v0.6.7"
+	dump    bool
+	random  bool
+	notify  bool
+	print   bool
+
+	err     error
+	body    string
+	file    string
+	reqInfo map[string]string
+
+	apodDate string
+)
+
 func main() {
+	initCetus()
+
+	// Early Check: If command was not passed then print usage and
+	// exit. Later command & service both are checked, this check
+	// is for version command. If not checked then running cetus
+	// without any args will fail because os.Args[1] will panic
+	// the program & produce runtime error.
+	if len(os.Args) == 1 {
+		printUsage()
+		os.Exit(0)
+	}
+
+	parseArgs()
+}
+
+func initCetus() {
 	unveil()
-	app()
 }
 
 func unveil() {
diff --git a/cmd/cetus/app.go b/parseargs.go
index 32225d7..d47d30d 100644
--- a/cmd/cetus/app.go
+++ b/parseargs.go
@@ -8,35 +8,6 @@ import (
 	"time"
 )
 
-var (
-	version string = "v0.6.7"
-	dump    bool
-	random  bool
-	notify  bool
-	print   bool
-
-	err     error
-	body    string
-	file    string
-	reqInfo map[string]string
-
-	apodDate string
-)
-
-func app() {
-	// Early Check: If command was not passed then print usage and
-	// exit. Later command & service both are checked, this check
-	// is for version command. If not checked then running cetus
-	// without any args will fail because os.Args[1] will panic
-	// the program & produce runtime error.
-	if len(os.Args) == 1 {
-		printUsage()
-		os.Exit(0)
-	}
-
-	parseArgs()
-}
-
 // parseArgs will be parsing the arguments, it will verify if they are
 // correct. Flag values are also set by parseArgs.
 func parseArgs() {
diff --git a/cmd/cetus/usage.go b/usage.go
index e9e2f71..e9e2f71 100644
--- a/cmd/cetus/usage.go
+++ b/usage.go