forked from aeyoll/soulseek-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·40 lines (34 loc) · 1.25 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
#!/usr/bin/env node
const VERSION = '0.3.0';
import { Command } from 'commander';
import DownloadCommand from './src/commands/download.js';
import QueryCommand from './src/commands/query.js';
import LoginCommand from './src/commands/login.js';
const program = new Command();
program.version(VERSION);
program
.command('download [query...]')
.description('Download with required query')
.option('-d, --destination <folder>', 'downloads\'s destination')
.option('-q, --quality <quality>', 'show only mp3 with a defined quality')
.option('-m, --mode <mode>', 'filter the kind of files you want (available: "mp3", "flac", default: "mp3")', 'mp3')
.alias('d')
.action((queries, options) => {
new DownloadCommand(queries, options);
});
program
.command('query [query...]')
.description('Search with required query, but don\'t download anything')
.option('-q, --quality <quality>', 'show only mp3 with a defined quality')
.option('-m, --mode <mode>', 'filter the kind of files you want (available: "mp3", "flac", default: "mp3")', 'mp3')
.alias('q')
.action((queries, options) => {
new QueryCommand(queries, options);
});
program
.command('login')
.alias('l')
.action(() => {
new LoginCommand();
});
program.parse(process.argv);