-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
40 lines (33 loc) · 905 Bytes
/
app.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
import { performApp, performAccounts, performForecast } from './lib/vaersparing';
import { ArgumentParser } from 'argparse';
import pckg from './package.json';
const parser = new ArgumentParser({
version: pckg.version,
description: 'Værsparing'
});
const group = parser.addMutuallyExclusiveGroup({ required: true });
group.addArgument(['-a', '--accounts'], {
help: 'List opp kontoer.',
action: 'storeTrue'
});
group.addArgument(['-f', '--forecast'], {
help: 'Vis værmelding for i dag på ditt sted.',
action: 'storeTrue'
});
group.addArgument(['-s', '--save'], {
help: 'Utfør sparing basert på værmelding.',
action: 'storeTrue'
});
const args = parser.parseArgs();
if (args.save) {
performApp();
}
else if (args.forecast) {
performForecast();
}
else if (args.accounts) {
performAccounts();
}
else {
console.log('Hyggelig at du stakk innom!');
}