-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
executable file
·63 lines (56 loc) · 1.52 KB
/
index.js
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
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env node
const program = require('commander')
const package = require('./package')
const { features, categories } = require('./constants')
const Wallpaper = require('./wallpaper')
program
.version(package.version)
.option('-f, --feature <featureName>', 'photo stream to be retrieved')
.option(
'-c, --category <categoryName>',
'category to return photos from (case sensitive, separate multiple values with a comma)',
)
.option(
'-w, --width <minWidth>',
'minimum width of the photo to be downloaded',
)
.option(
'-H, --height <minHeight>',
'minimum height of the photo to be downloaded',
)
.option('-l, --landscape', 'the photo must be in landscape orientation')
.option('-o, --output <fileName>', 'destination file name without extension')
.addHelpText(
'after',
`
Features:
${features.join(', ')}
Categories:
${categories.join(', ')}
Examples:
$ ${package.name}
$ ${package.name} -o wallpaper
$ ${package.name} ${[
'-f editors',
'-c Landscapes',
'-H 2048',
'-l',
'-o ~/Images/wallpaper',
].join(' ')}
$ ${package.name} ${[
'-f popular',
'-c "City and Architecture,Landscapes,Nature,Travel"',
'-H 4096',
'-l',
].join(' ')}`,
)
program.parse(process.argv)
const options = program.opts()
new Wallpaper({
outFileName: options.output,
feature: options.feature,
category: options.category,
minWidth: options.width,
minHeight: options.height,
mustBeLandscape: options.landscape,
}).findAndDownload()