##// END OF EJS Templates
add locate subcommands for IPython
MinRK -
Show More
@@ -85,6 +85,8 b' ipython profile create foo --parallel # also stage parallel config files'
85 85 _main_examples = """
86 86 ipython profile create -h # show the help string for the create subcommand
87 87 ipython profile list -h # show the help string for the list subcommand
88
89 ipython profile locate foo # print the path to the directory for profile 'foo'
88 90 """
89 91
90 92 #-----------------------------------------------------------------------------
@@ -115,6 +117,18 b' def list_bundled_profiles():'
115 117 return profiles
116 118
117 119
120 class ProfileLocate(BaseIPythonApplication):
121 description = """print the path an IPython profile dir"""
122
123 def parse_command_line(self, argv=None):
124 super(ProfileLocate, self).parse_command_line(argv)
125 if self.extra_args:
126 self.profile = self.extra_args[0]
127
128 def start(self):
129 print self.profile_dir.location
130
131
118 132 class ProfileList(Application):
119 133 name = u'ipython-profile'
120 134 description = list_help
@@ -277,8 +291,9 b' class ProfileApp(Application):'
277 291 examples = _main_examples
278 292
279 293 subcommands = Dict(dict(
280 create = (ProfileCreate, "Create a new profile dir with default config files"),
281 list = (ProfileList, "List existing profiles")
294 create = (ProfileCreate, ProfileCreate.description.splitlines()[0]),
295 list = (ProfileList, ProfileList.description.splitlines()[0]),
296 locate = (ProfileLocate, ProfileLocate.description.splitlines()[0]),
282 297 ))
283 298
284 299 def start(self):
@@ -78,6 +78,9 b' ipython help notebook # show the help for the notebook subcmd'
78 78
79 79 ipython profile create foo # create profile foo w/ default config files
80 80 ipython help profile # show the help for the profile subcmd
81
82 ipython locate # print the path to the IPython directory
83 ipython locate profile foo # print the path to the directory for profile `foo`
81 84 """
82 85
83 86 #-----------------------------------------------------------------------------
@@ -191,6 +194,21 b' aliases.update(dict('
191 194 # Main classes and functions
192 195 #-----------------------------------------------------------------------------
193 196
197
198 class LocateIPythonApp(BaseIPythonApplication):
199 description = """print the path to the IPython dir"""
200 subcommands = Dict(dict(
201 profile=('IPython.core.profileapp.ProfileLocate',
202 "print the path to an IPython profile directory",
203 ),
204 ))
205 def start(self):
206 if self.subapp is not None:
207 return self.subapp.start()
208 else:
209 print self.ipython_dir
210
211
194 212 class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):
195 213 name = u'ipython'
196 214 description = usage.cl_usage
@@ -230,6 +248,9 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
230 248 console=('IPython.frontend.terminal.console.app.ZMQTerminalIPythonApp',
231 249 """Launch the IPython terminal-based Console."""
232 250 ),
251 locate=('IPython.frontend.terminal.ipapp.LocateIPythonApp',
252 LocateIPythonApp.description
253 ),
233 254 ))
234 255
235 256 # *do* autocreate requested profile, but don't create the config file.
General Comments 0
You need to be logged in to leave comments. Login now