Get or set the profile. If .profile is called with no args, the current profile is displayed. If the .profile command is called with a single arg, then the current profile for the application will be set to the new value.
(self, command, application)
| 122 | self._err = err |
| 123 | |
| 124 | def run(self, command, application): |
| 125 | """Get or set the profile. |
| 126 | |
| 127 | If .profile is called with no args, the current profile |
| 128 | is displayed. If the .profile command is called with a |
| 129 | single arg, then the current profile for the application |
| 130 | will be set to the new value. |
| 131 | """ |
| 132 | if len(command) == 1: |
| 133 | profile = application.profile |
| 134 | if profile is None: |
| 135 | self._output.write( |
| 136 | "Current shell profile: no profile configured\n" |
| 137 | "You can change profiles using: .profile profile-name\n") |
| 138 | else: |
| 139 | self._output.write("Current shell profile: %s\n" % profile) |
| 140 | elif len(command) == 2: |
| 141 | new_profile_name = command[1] |
| 142 | application.profile = new_profile_name |
| 143 | self._output.write("Current shell profile changed to: %s\n" % |
| 144 | new_profile_name) |
| 145 | else: |
| 146 | self._err.write("Usage:\n%s\n" % self.USAGE) |
| 147 | |
| 148 | |
| 149 | class ExitHandler(object): |
no outgoing calls