1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 """
19 The ApplicationArguments class parses the command line arguments and
20 options when the application is started.
21
22 If the application is started with:
23 python3 timeline.py -h
24
25 a text will be displayed that describes valid arguments and valid
26 options.
27
28 :doc:`Tests are found here <unit_config_arguments>`.
29 """
30
31
32 from optparse import OptionParser
33 import os.path
34
35 from timelinelib.meta.version import get_full_version
36
37 import wx
38
39
41
43 self._option_parser = self._create_option_parser()
44 self._create_config_file_option()
45 self._create_debug_option()
46
49
52
54 try:
55 return self.arguments[0]
56 except IndexError:
57 return None
58
61
63 return self.options.debug
64
66 if self.options.config_file_path:
67 return self.options.config_file_path
68 else:
69 return os.path.join(
70 wx.StandardPaths.Get().GetUserConfigDir(),
71 ".thetimelineproj.cfg")
72
74 return OptionParser(
75 usage="%prog [options] [filename]",
76 version=self._create_version_string())
77
80
82 self._option_parser.add_option(
83 "-c", "--config-file", dest="config_file_path", default=None,
84 help="Path to config file")
85
87 self._option_parser.add_option(
88 "--debug",
89 default=False, action="store_true",
90 help="Run Timeline with extra debug output")
91