| 132 | |
| 133 | |
| 134 | class ProfileList(Application): |
| 135 | name = u'ipython-profile' |
| 136 | description = list_help |
| 137 | examples = _list_examples |
| 138 | |
| 139 | aliases = Dict({ |
| 140 | 'ipython-dir' : 'ProfileList.ipython_dir', |
| 141 | 'log-level' : 'Application.log_level', |
| 142 | }) |
| 143 | flags = Dict(dict( |
| 144 | debug = ({'Application' : {'log_level' : 0}}, |
| 145 | "Set Application.log_level to 0, maximizing log output." |
| 146 | ) |
| 147 | )) |
| 148 | |
| 149 | ipython_dir = Unicode(get_ipython_dir(), |
| 150 | help=""" |
| 151 | The name of the IPython directory. This directory is used for logging |
| 152 | configuration (through profiles), history storage, etc. The default |
| 153 | is usually $HOME/.ipython. This options can also be specified through |
| 154 | the environment variable IPYTHONDIR. |
| 155 | """ |
| 156 | ).tag(config=True) |
| 157 | |
| 158 | |
| 159 | def _print_profiles(self, profiles): |
| 160 | """print list of profiles, indented.""" |
| 161 | for profile in profiles: |
| 162 | print(' %s' % profile) |
| 163 | |
| 164 | def list_profile_dirs(self): |
| 165 | profiles = list_bundled_profiles() |
| 166 | if profiles: |
| 167 | print() |
| 168 | print("Available profiles in IPython:") |
| 169 | self._print_profiles(profiles) |
| 170 | print() |
| 171 | print(" The first request for a bundled profile will copy it") |
| 172 | print(" into your IPython directory (%s)," % self.ipython_dir) |
| 173 | print(" where you can customize it.") |
| 174 | |
| 175 | profiles = list_profiles_in(self.ipython_dir) |
| 176 | if profiles: |
| 177 | print() |
| 178 | print("Available profiles in %s:" % self.ipython_dir) |
| 179 | self._print_profiles(profiles) |
| 180 | |
| 181 | profiles = list_profiles_in(os.getcwd()) |
| 182 | if profiles: |
| 183 | print() |
| 184 | print( |
| 185 | "Profiles from CWD have been removed for security reason, see CVE-2022-21699:" |
| 186 | ) |
| 187 | |
| 188 | print() |
| 189 | print("To use any of the above profiles, start IPython with:") |
| 190 | print(" ipython --profile=<name>") |
| 191 | print() |
nothing calls this directly
no test coverage detected
searching dependent graphs…