summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--README.org28
-rw-r--r--main.go34
2 files changed, 31 insertions, 31 deletions
diff --git a/README.org b/README.org
index 8543467..8be0ac6 100644
--- a/README.org
+++ b/README.org
@@ -4,10 +4,10 @@ Cetus is a wallpaper tool written in Go. It can set wallpapers from various
 sources. Default behaviour is to set a random wallpaper.
 
 * Defaults
-| flag   | var    | default                                   |
-|--------+--------+-------------------------------------------|
-| mode   | mode   | random (daily when random is unavailable) |
-| src    | src    | random                                    |
+| flag | var  | default                                   |
+|------+------+-------------------------------------------|
+| wall | wall | random (daily when random is unavailable) |
+| src  | src  | random                                    |
 
 Currently only Unsplash Source random is supported for width, height
 | width  | width  | 1920 |
@@ -17,7 +17,7 @@ Currently only Unsplash Source random is supported for width, height
 |--------------+------------+-------------------------------------|
 | apod-api     | apodAPI    | https://api.nasa.gov/planetary/apod |
 | apod-api-key | apodAPIKey | DEMO_KEY                            |
-| mode         | mode       | daily                               |
+| wall         | wall       | daily                               |
 ** Bing Photo of the Day
 | flag     | var     | default                                  |
 |----------+---------+------------------------------------------|
@@ -36,43 +36,43 @@ Currently only Unsplash Source random is supported for width, height
 ** Daily wallpaper
 *** from Astronomy Picture of the Day
 #+BEGIN_SRC sh
-cetus -src=apod -mode=daily
+cetus -src=apod -wall=daily
 #+END_SRC
 *** from Bing Photo of the Day
 #+BEGIN_SRC sh
-cetus -src=bpod -mode=daily
+cetus -src=bpod -wall=daily
 #+END_SRC
 *** from Unsplash Source
 #+BEGIN_SRC sh
-cetus -src=unsplash -mode=daily
+cetus -src=unsplash -wall=daily
 #+END_SRC
 *** from any service (choosen randomly)
 #+BEGIN_SRC sh
-cetus -src=random -mode=daily
+cetus -src=random -wall=daily
 
-cetus -mode=daily # This is same as above
+cetus -wall=daily # This is same as above
 #+END_SRC
 ** Weekly wallpaper
 *** from Unsplash Source
 #+BEGIN_SRC shp
-cetus -src=unsplash -mode=weekly
+cetus -src=unsplash -wall=weekly
 #+END_SRC
 ** Random wallpaper
 *** from Bing Photo of the Day
 #+BEGIN_SRC sh
-cetus -src=bpod -bpod-num 16 -mode=random # select from last 16 images
+cetus -src=bpod -bpod-num 16 -wall=random # select from last 16 images
 
 cetus -src=bpod # This is same as above
 #+END_SRC
 *** from Unsplash Source
 #+BEGIN_SRC sh
-cetus -src=unsplash -mode=random -width 1920 -height 1080
+cetus -src=unsplash -wall=random -width 1920 -height 1080
 
 cetus -src=unsplash # This is same as above
 #+END_SRC
 *** from any service (choosen randomly)
 #+BEGIN_SRC sh
-cetus -src=random -mode=random
+cetus -src=random -wall=random
 
 cetus # This is same as above
 #+END_SRC
diff --git a/main.go b/main.go
index c8ad829..9eca522 100644
--- a/main.go
+++ b/main.go
@@ -47,7 +47,7 @@ func main() {
 		err error
 
 		imgPath string
-		mode    string
+		wall    string
 		src     string
 		srcArr  []string = []string{
 			"apod",
@@ -58,7 +58,7 @@ func main() {
 
 	// Parse flags passed to program
 	flag.StringVar(&src, "src", "random", "Source for the image")
-	flag.StringVar(&mode, "mode", "random", "Daily, Weekly or Random wallpaper")
+	flag.StringVar(&wall, "wall", "random", "Daily, Weekly or Random wallpaper")
 
 	flag.IntVar(&width, "width", 1920, "Width of the image")
 	flag.IntVar(&height, "height", 1080, "Height of the image")
@@ -80,7 +80,7 @@ func main() {
 		log.Fatal("Error: Unknown Source")
 	}
 
-	imgPath, err = parseSrcAndGetPath(src, mode)
+	imgPath, err = parseSrcAndGetPath(src, wall)
 	errChk(err)
 
 	err = setWall(imgPath)
@@ -97,34 +97,34 @@ func contains(arr []string, str string) bool {
 }
 
 // Gets image path from src
-func parseSrcAndGetPath(src string, mode string) (string, error) {
+func parseSrcAndGetPath(src string, wall string) (string, error) {
 	var err error
 	var imgPath string
 
 	switch src {
 	case "apod":
 		fmt.Println("Astronomy Picture of the Day")
-		imgPath, err = getPathAPOD(mode)
+		imgPath, err = getPathAPOD(wall)
 	case "bpod":
 		fmt.Println("Bing Photo of the Day")
-		imgPath, err = getPathBPOD(mode)
+		imgPath, err = getPathBPOD(wall)
 	case "unsplash":
 		fmt.Println("Unsplash Source")
-		imgPath, err = getPathUnsplash(mode)
+		imgPath, err = getPathUnsplash(wall)
 	}
 
 	return imgPath, err
 }
 
-func getPathAPOD(mode string) (string, error) {
+func getPathAPOD(wall string) (string, error) {
 	var err error
 	var imgPath string
 
-	switch mode {
+	switch wall {
 	case "daily", "random":
 		break
 	default:
-		return "", fmt.Errorf("Error: Unknown Mode")
+		return "", fmt.Errorf("Error: Unknown wall")
 	}
 
 	type apodRes struct {
@@ -169,7 +169,7 @@ func getPathAPOD(mode string) (string, error) {
 	return imgPath, err
 }
 
-func getPathBPOD(mode string) (string, error) {
+func getPathBPOD(wall string) (string, error) {
 	var err error
 	var imgPath string
 
@@ -198,14 +198,14 @@ func getPathBPOD(mode string) (string, error) {
 	q := req.URL.Query()
 	q.Add("format", "js")
 
-	switch mode {
+	switch wall {
 	case "daily":
 		q.Add("n", "1")
 	case "random":
 		// Fetches 16 images (only info) & chooses a random image
 		q.Add("n", strconv.Itoa(bpodNum))
 	default:
-		return "", fmt.Errorf("Error: Unknown Mode")
+		return "", fmt.Errorf("Error: Unknown wall")
 	}
 
 	req.URL.RawQuery = q.Encode()
@@ -233,19 +233,19 @@ func getPathBPOD(mode string) (string, error) {
 	return imgPath, err
 }
 
-func getPathUnsplash(mode string) (string, error) {
+func getPathUnsplash(wall string) (string, error) {
 	var err error
 	var imgPath string
 
-	switch mode {
+	switch wall {
 	case "daily", "weekly":
 		unsplashAPI = fmt.Sprintf("%s/%s",
-			unsplashAPI, mode)
+			unsplashAPI, wall)
 	case "random":
 		unsplashAPI = fmt.Sprintf("%s/%sx%s",
 			unsplashAPI, strconv.Itoa(width), strconv.Itoa(height))
 	default:
-		return "", fmt.Errorf("Error: Unknown Mode")
+		return "", fmt.Errorf("Error: Unknown wall")
 	}
 
 	req, err := http.NewRequest(http.MethodGet, unsplashAPI, nil)