summary refs log tree commit diff stats
path: root/cmd
diff options
context:
space:
mode:
authorAndinus <andinus@inventati.org>2020-03-14 13:11:52 +0530
committerAndinus <andinus@inventati.org>2020-03-14 13:11:52 +0530
commitea8a01e9ae40f5478167abcf4563682adc77efb6 (patch)
treed1392b8cfe51d3105bc8bd3b84820de66488b8d9 /cmd
parent79f249d1db5843f2966330ddc75a8c71bb8a9ca0 (diff)
downloadcetus-ea8a01e9ae40f5478167abcf4563682adc77efb6.tar.gz
Add photoID support
photo-id flag can be used to set a specific photo as background
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cetus/cetus.go37
1 files changed, 36 insertions, 1 deletions
diff --git a/cmd/cetus/cetus.go b/cmd/cetus/cetus.go
index 2618245..35afd01 100644
--- a/cmd/cetus/cetus.go
+++ b/cmd/cetus/cetus.go
@@ -14,4 +14,39 @@
 
 package main
 
-func main() {}
+import (
+	"flag"
+	"log"
+
+	"framagit.org/andinus/cetus/pkg/unsplash"
+)
+
+func main() {
+	var (
+		photoID string
+
+		width  int
+		height int
+
+		err error
+	)
+
+	flag.StringVar(&photoID, "photo-id", "", "Unsplash Photo ID to set as background")
+
+	flag.IntVar(&width, "width", 1920, "Width of the image")
+	flag.IntVar(&height, "height", 1080, "Height of the image")
+
+	flag.Parse()
+
+	if len(photoID) != 0 {
+		err = unsplash.SetFromID(photoID, width, height)
+		errChk(err)
+		return
+	}
+}
+
+func errChk(err error) {
+	if err != nil {
+		log.Fatal(err)
+	}
+}
ref='#n157'>157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297