##// END OF EJS Templates
Trim which options are exposed on kernelspec CLI
Thomas Kluyver -
Show More
@@ -131,7 +131,7 b' class BaseIPythonApplication(Application):'
131 help="""
131 help="""
132 The name of the IPython directory. This directory is used for logging
132 The name of the IPython directory. This directory is used for logging
133 configuration (through profiles), history storage, etc. The default
133 configuration (through profiles), history storage, etc. The default
134 is usually $HOME/.ipython. This options can also be specified through
134 is usually $HOME/.ipython. This option can also be specified through
135 the environment variable IPYTHONDIR.
135 the environment variable IPYTHONDIR.
136 """
136 """
137 )
137 )
@@ -6,7 +6,9 b' import errno'
6 import os.path
6 import os.path
7
7
8 from IPython.config.application import Application
8 from IPython.config.application import Application
9 from IPython.core.application import BaseIPythonApplication, base_flags
9 from IPython.core.application import (
10 BaseIPythonApplication, base_flags, base_aliases
11 )
10 from IPython.utils.traitlets import Instance, Dict, Unicode, Bool
12 from IPython.utils.traitlets import Instance, Dict, Unicode, Bool
11
13
12 from .kernelspec import KernelSpecManager
14 from .kernelspec import KernelSpecManager
@@ -21,6 +23,10 b' class ListKernelSpecs(BaseIPythonApplication):'
21 description = """List installed kernel specifications."""
23 description = """List installed kernel specifications."""
22 kernel_spec_manager = Instance(KernelSpecManager)
24 kernel_spec_manager = Instance(KernelSpecManager)
23
25
26 # Not all of the base aliases are meaningful (e.g. profile)
27 aliases = {k: base_aliases[k] for k in ['ipython-dir', 'log-level']}
28 flags = {'debug': base_flags['debug'],}
29
24 def _kernel_spec_manager_default(self):
30 def _kernel_spec_manager_default(self):
25 return KernelSpecManager(ipython_dir=self.ipython_dir)
31 return KernelSpecManager(ipython_dir=self.ipython_dir)
26
32
@@ -56,13 +62,15 b' class InstallKernelSpec(BaseIPythonApplication):'
56 )
62 )
57
63
58 aliases = {'name': 'InstallKernelSpec.kernel_name'}
64 aliases = {'name': 'InstallKernelSpec.kernel_name'}
65 for k in ['ipython-dir', 'log-level']:
66 aliases[k] = base_aliases[k]
59
67
60 flags = {'system': ({'InstallKernelSpec': {'system': True}},
68 flags = {'system': ({'InstallKernelSpec': {'system': True}},
61 "Install to the systemwide kernel registry"),
69 "Install to the systemwide kernel registry"),
62 'replace': ({'InstallKernelSpec': {'replace': True}},
70 'replace': ({'InstallKernelSpec': {'replace': True}},
63 "Replace any existing kernel spec with this name."),
71 "Replace any existing kernel spec with this name."),
72 'debug': base_flags['debug'],
64 }
73 }
65 flags.update(base_flags)
66
74
67 def parse_command_line(self, argv):
75 def parse_command_line(self, argv):
68 super(InstallKernelSpec, self).parse_command_line(argv)
76 super(InstallKernelSpec, self).parse_command_line(argv)
@@ -98,6 +106,9 b' class KernelSpecApp(Application):'
98 install = (InstallKernelSpec, InstallKernelSpec.description.splitlines()[0])
106 install = (InstallKernelSpec, InstallKernelSpec.description.splitlines()[0])
99 ))
107 ))
100
108
109 aliases = {}
110 flags = {}
111
101 def start(self):
112 def start(self):
102 if self.subapp is None:
113 if self.subapp is None:
103 print("No subcommand specified. Must specify one of: %s"% list(self.subcommands))
114 print("No subcommand specified. Must specify one of: %s"% list(self.subcommands))
General Comments 0
You need to be logged in to leave comments. Login now