| 112 | |
| 113 | |
| 114 | class AliasCommandInjector(BaseAliasCommandInjector): |
| 115 | def __init__(self, session, alias_loader): |
| 116 | """Injects alias commands for a command table |
| 117 | |
| 118 | :type session: botocore.session.Session |
| 119 | :param session: The botocore session |
| 120 | |
| 121 | :type alias_loader: awscli.alias.AliasLoader |
| 122 | :param alias_loader: The alias loader to use |
| 123 | """ |
| 124 | super(AliasCommandInjector, self).__init__(alias_loader) |
| 125 | self._session = session |
| 126 | |
| 127 | def inject_aliases(self, command_table, parser): |
| 128 | for alias_name, alias_value in self._get_alias_items(): |
| 129 | if self._is_external_alias(alias_value): |
| 130 | self._inject_external_alias( |
| 131 | alias_name, alias_value, command_table |
| 132 | ) |
| 133 | else: |
| 134 | service_alias_cmd_args = [ |
| 135 | alias_name, |
| 136 | alias_value, |
| 137 | self._session, |
| 138 | command_table, |
| 139 | parser, |
| 140 | ] |
| 141 | # If the alias name matches something already in the |
| 142 | # command table provide the command it is about |
| 143 | # to clobber as a possible reference that it will |
| 144 | # need to proxy to. |
| 145 | if alias_name in command_table: |
| 146 | service_alias_cmd_args.append(command_table[alias_name]) |
| 147 | alias_cmd = ServiceAliasCommand(*service_alias_cmd_args) |
| 148 | command_table[alias_name] = alias_cmd |
| 149 | |
| 150 | |
| 151 | class AliasSubCommandInjector(BaseAliasCommandInjector): |
no outgoing calls