Move app func to main
This commit is contained in:
parent
a01ce7b968
commit
53d4a70ed2
|
@ -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() {
|
|
@ -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() {
|
Loading…
Reference in New Issue