-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
executable file
·54 lines (50 loc) · 1.36 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
const { getConf } = require("./config.js");
const { fixPayees, calculateMortage, ghostfolioSync, holdAmoutForNextMonth, bankSync } = require("./engine.js");
let config;
/**
*
* @param {string} command
* @param {object} flags
* @param {string} flags.since
*/
module.exports = async (command, flags) => {
if (!command) {
console.log('Try "actualtasks --help"');
process.exit();
}
config = getConf(flags.user || "default")
if (command === "config") {
console.log(`Config for this app is located at: ${config.path}`);
} else if (command === "fix-payees") {
try{
await fixPayees();
} catch (e){
console.error(e);
}
} else if (command === "calculate-mortage") {
try{
await calculateMortage();
} catch (e){
console.error(e);
}
} else if (command === "ghostfolio-sync") {
try{
await ghostfolioSync();
} catch (e){
console.error(e);
}
} else if (command === "hold-amout-for-next-month") {
try{
await holdAmoutForNextMonth();
} catch (e){
console.error(e);
}
} else if (command === "bank-sync") {
try{
await bankSync();
} catch (e){
console.error(e);
}
}
process.exit();
};