-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.ts
63 lines (56 loc) Β· 1.23 KB
/
index.ts
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
/**
* Reimplementation of snap-tweet CLI: https://github.com/privatenumber/snap-tweet
*
* Usage:
* npx esno examples/snap-tweet --help
*/
import { cli } from '../../src';
const argv = cli({
name: 'snap-tweet',
version: '1.0.0',
parameters: ['<tweet urls...>'],
flags: {
outputDir: {
type: String,
alias: 'o',
description: 'Tweet screenshot output directory',
placeholder: '<path>',
},
width: {
type: Number,
alias: 'w',
description: 'Width of tweet',
default: 550,
placeholder: '<width>',
},
showTweet: {
type: Boolean,
alias: 't',
description: 'Show tweet thread',
},
darkMode: {
type: Boolean,
alias: 'd',
description: 'Show tweet in dark mode',
},
locale: {
type: String,
description: 'Locale',
default: 'en',
placeholder: '<locale>',
},
},
help: {
examples: [
'# Snapshot a tweet',
'snap-tweet https://twitter.com/jack/status/20',
'',
'# Snapshot a tweet with Japanese locale',
'snap-tweet https://twitter.com/TwitterJP/status/578707432 --locale ja',
'',
'# Snapshot a tweet with dark mode and 900px width',
'snap-tweet https://twitter.com/Interior/status/463440424141459456 --width 900 --dark-mode',
],
},
});
console.log(argv);