-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
54 lines (46 loc) · 1.01 KB
/
cli.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
import { parseArgs } from "node:util";
import downloader from "./index.js";
const { values } = parseArgs({
options: {
url: {
type: "string",
short: "u",
},
output: {
type: "string",
default: "out",
short: "o",
},
verbose: {
type: "boolean",
default: false,
short: "v",
},
help: {
type: "boolean",
default: false,
short: "h",
},
},
});
if (values.help) {
console.log(`
Example usage:
================================
podcastdl --url https://foo.bar
=> basic usage, download the podcast feed to the default folder "out"
podcastdl --url https://foo.bar --output a-folder --verbose
=> download the podcast feed to the folder "a-folder" and show more logs
Options:
url: the url of the podcast feed
--url or -u
output: the folder to save the podcast files
--output or -o
verbose: show more logs
--verbose or -v
help: show this help
--help or -h
`);
process.exit(0);
}
downloader(values.url, values.output, values.verbose);