Show More
@@ -33,6 +33,30 b' from IPython.utils.traitlets import (' | |||
|
33 | 33 | from IPython.utils.text import indent |
|
34 | 34 | |
|
35 | 35 | #----------------------------------------------------------------------------- |
|
36 | # Descriptions for | |
|
37 | #----------------------------------------------------------------------------- | |
|
38 | ||
|
39 | macro_description = """ | |
|
40 | Flags are command-line arguments passed as '--<flag>'. | |
|
41 | These take no parameters, unlike regular key-value arguments. | |
|
42 | They are typically used for setting boolean flags, or enabling | |
|
43 | modes that involve setting multiple options together. | |
|
44 | """.strip() # trim newlines of front and back | |
|
45 | ||
|
46 | shortname_description = """ | |
|
47 | These are commonly set parameters, given abbreviated aliases for convenience. | |
|
48 | They are set in the same `name=value` way as class parameters, where | |
|
49 | <name> is replaced by the real parameter for which it is an alias. | |
|
50 | """.strip() # trim newlines of front and back | |
|
51 | ||
|
52 | keyvalue_description = """ | |
|
53 | Parameters are set from command-line arguments of the form: | |
|
54 | `Class.trait=value`. Parameters will *never* be prefixed with '-'. | |
|
55 | This line is evaluated in Python, so simple expressions are allowed, e.g. | |
|
56 | `C.a='range(3)'` For setting C.a=[0,1,2] | |
|
57 | """.strip() # trim newlines of front and back | |
|
58 | ||
|
59 | #----------------------------------------------------------------------------- | |
|
36 | 60 | # Application class |
|
37 | 61 | #----------------------------------------------------------------------------- |
|
38 | 62 | |
@@ -47,6 +71,11 b' class Application(SingletonConfigurable):' | |||
|
47 | 71 | # The description of the application that is printed at the beginning |
|
48 | 72 | # of the help. |
|
49 | 73 | description = Unicode(u'This is an application.') |
|
74 | # default section descriptions | |
|
75 | macro_description = Unicode(macro_description) | |
|
76 | shortname_description = Unicode(shortname_description) | |
|
77 | keyvalue_description = Unicode(keyvalue_description) | |
|
78 | ||
|
50 | 79 | |
|
51 | 80 | # A sequence of Configurable subclasses whose config=True attributes will |
|
52 | 81 | # be exposed at the command line (shortnames and help). |
@@ -109,9 +138,13 b' class Application(SingletonConfigurable):' | |||
|
109 | 138 | |
|
110 | 139 | print "Aliases" |
|
111 | 140 | print "-------" |
|
141 | print self.shortname_description | |
|
142 | ||
|
143 | ||
|
112 | 144 | classdict = {} |
|
113 | 145 | for c in self.classes: |
|
114 | 146 | classdict[c.__name__] = c |
|
147 | ||
|
115 | 148 | for shortname, longname in self.shortnames.iteritems(): |
|
116 | 149 | classname, traitname = longname.split('.',1) |
|
117 | 150 | cls = classdict[classname] |
@@ -130,6 +163,8 b' class Application(SingletonConfigurable):' | |||
|
130 | 163 | |
|
131 | 164 | print "Flags" |
|
132 | 165 | print "-----" |
|
166 | print self.macro_description | |
|
167 | ||
|
133 | 168 | |
|
134 | 169 | for m, cfg in self.macros.iteritems(): |
|
135 | 170 | print '--'+m |
@@ -140,6 +175,12 b' class Application(SingletonConfigurable):' | |||
|
140 | 175 | """Print the help for each Configurable class in self.classes.""" |
|
141 | 176 | self.print_macro_help() |
|
142 | 177 | self.print_shortname_help() |
|
178 | if self.classes: | |
|
179 | print "Class parameters" | |
|
180 | print "----------------" | |
|
181 | print self.keyvalue_description | |
|
182 | ||
|
183 | ||
|
143 | 184 | for cls in self.classes: |
|
144 | 185 | cls.class_print_help() |
|
145 | 186 |
General Comments 0
You need to be logged in to leave comments.
Login now