blob: e18bbc0204b786e39ea18491fa2711446f75635f (
plain)
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
|
#!/usr/bin/python3.6
"""The tagit application.
Part of the tagit module.
A copy of the license is provided with the project.
Author: Matthias Baumgartner, 2022
"""
# imports
import argparse
import sys
# module imports
import tagit
import tagit.apps
# config
apps = {
'desktop' : tagit.apps.desktop,
}
## code ##
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Image tagger tool.', prog='tagit')
# version
parser.add_argument('--version', action='version',
version='%(prog)s {}.{}.{}'.format(*tuple(tagit.version_info)))
# application selection
parser.add_argument('app', choices=apps.keys(), nargs='?', default='desktop',
help='Select the application to run.')
# dangling args
parser.add_argument('rest', nargs=argparse.REMAINDER)
# parse
args = parser.parse_args()
# run application
try:
apps[args.app](args.rest)
except Exception as e:
print(str(e))
## EOF ##
|