-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.ts
28 lines (23 loc) · 910 Bytes
/
main.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
#!/usr/bin/env node
import { program, OptionValues } from 'commander';
import * as pjson from './package.json';
import { okkyList } from './lib/OkkyList';
import ora from 'ora';
program
.version(`okky-list ${pjson.version}`, '-v, --version')
.usage('[options]')
.option('-l, --list [item]', 'add list filter by questions, tech, community, columns, jobs', 'community')
.option('-n, --number <number>', 'the last [number] lines allowed 1...20', '20')
.option('-s, --sort [item]', 'order by id, voteCount, noteCount, scrapCount, viewCount', 'id')
.parse(process.argv);
const optionValues: OptionValues = {
list: program.getOptionValue('list'),
number: program.getOptionValue('number'),
sort: program.getOptionValue('sort')
}
const spinner = ora('Loading okky\n').start();
okkyList.getList(optionValues).then(result => {
console.log(result);
spinner.succeed('OK');
process.exit(0);
});