-
Notifications
You must be signed in to change notification settings - Fork 0
/
toolss.dart
executable file
·66 lines (56 loc) · 1.39 KB
/
toolss.dart
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
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env dart
import 'dart:convert';
import 'dart:io';
import 'package:args/args.dart';
import 'dart_toolss/date.dart';
import 'dart_toolss/funcs.dart';
import 'dart_toolss/proc_arb.dart';
import 'dart_toolss/crypto.dart';
void main(List<String> arguments) async {
exitCode = 0;
final parser = ArgParser()
..addCommand('help')
..addCommand('date')
..addFlag('compare', abbr: 'c')
..addOption('timezone', abbr: 'z')
..addCommand('arb')
..addFlag('fill_source')
..addFlag('generate', abbr: 'g')
..addFlag('convert')
..addFlag('template', abbr: 't')
..addFlag('name_only')
..addCommand('crypto')
..addFlag('ada');
ArgResults? argResults;
print('\n * TOOLSS OUTPUT * \n');
try {
argResults = parser.parse(arguments);
} catch (e) {
errorExit('flag or option error');
}
try {
argResults!;
final rest = argResults.command?.rest;
switch (argResults.command?.name) {
case 'date':
dateMain(argResults, rest);
break;
case 'arb':
await arbMain(argResults, rest);
break;
case 'help':
help();
break;
case 'crypto':
await cryptoMain(argResults, rest);
break;
default:
printPrompt('no command input or not valid command.');
break;
}
} catch (e) {
print(e);
errorExit('toolss error');
}
successExit();
}