/
cli_options.py
156 lines (152 loc) · 4.48 KB
/
cli_options.py
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
import argparse
def get_options(argv=None):
"""
Convert options into commands.
Return commands, message
"""
parser = argparse.ArgumentParser(usage="spyder [options] files")
parser.add_argument(
'--new-instance',
action='store_true',
default=False,
help="Run a new instance of Spyder, even if the single "
"instance mode has been turned on (default)"
)
parser.add_argument(
'--defaults',
dest="reset_to_defaults",
action='store_true',
default=False,
help="Reset configuration settings to defaults"
)
parser.add_argument(
'--reset',
dest="reset_config_files",
action='store_true',
default=False,
help="Remove all configuration files!"
)
parser.add_argument(
'--optimize',
action='store_true',
default=False,
help="Optimize Spyder bytecode (this may require "
"administrative privileges)"
)
parser.add_argument(
'-w', '--workdir',
dest="working_directory",
default=None,
help="Default working directory"
)
parser.add_argument(
'--hide-console',
action='store_true',
default=False,
help="Hide parent console window (Windows)"
)
parser.add_argument(
'--show-console',
action='store_true',
default=False,
help="(Deprecated) Does nothing, now the default behavior "
"is to show the console"
)
parser.add_argument(
'--multithread',
dest="multithreaded",
action='store_true',
default=False,
help="Internal console is executed in another thread "
"(separate from main application thread)"
)
parser.add_argument(
'--profile',
action='store_true',
default=False,
help="Profile mode (internal test, not related "
"with Python profiling)"
)
parser.add_argument(
'--window-title',
type=str,
default=None,
help="String to show in the main window title"
)
parser.add_argument(
'-p', '--project',
default=None,
type=str,
dest="project",
help="Path that contains an Spyder project"
)
parser.add_argument(
'--opengl',
default=None,
dest="opengl_implementation",
choices=['software', 'desktop', 'gles'],
help="OpenGL implementation to pass to Qt"
)
parser.add_argument(
'--paths',
action='store_true',
default=False,
help="Show all Spyder configuration paths"
)
parser.add_argument(
'--debug-info',
default=None,
dest="debug_info",
choices=['minimal', 'verbose'],
help=("Level of internal debugging info to give. "
"'minimal' only logs a small amount of "
"confirmation messages and 'verbose' logs a "
"lot of detailed information.")
)
parser.add_argument(
'--debug-output',
default='terminal',
dest="debug_output",
choices=['terminal', 'file'],
help=("Print internal debugging info to the terminal and a file in "
"the configuration directory or to the terminal and a file "
"called spyder-debug.log in the current working directory. "
"Default is 'terminal'.")
)
parser.add_argument(
'--filter-log',
default='',
help="Comma-separated module name hierarchies whose log "
"messages should be shown. e.g., "
"spyder.plugins.completion,spyder.plugins.editor"
)
parser.add_argument(
'--safe-mode',
dest="safe_mode",
action='store_true',
default=False,
help="Start Spyder with a clean configuration directory"
)
parser.add_argument(
'--report-segfault',
dest="report_segfault",
action='store_true',
default=False,
help="Report segmentation fault to Github."
)
parser.add_argument(
'--conf-dir',
type=str,
dest="conf_dir",
default=None,
help="Choose a configuration directory to use for Spyder."
)
parser.add_argument('files', nargs='*')
options = parser.parse_args(argv)
args = options.files
return options, args