| Total Complexity | 2 |
| Total Lines | 14 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | import os |
||
| 8 | class MatchAction(Action): |
||
| 9 | def __init__(self, config=None): |
||
| 10 | super(MatchAction, self).__init__(config=config) |
||
| 11 | api_url = os.environ.get('ST2_ACTION_API_URL', None) |
||
| 12 | token = os.environ.get('ST2_ACTION_AUTH_TOKEN', None) |
||
| 13 | self.client = Client(api_url=api_url, token=token) |
||
| 14 | |||
| 15 | def run(self, text): |
||
| 16 | alias_match = ActionAliasMatch() |
||
| 17 | alias_match.command = text |
||
| 18 | matches = self.client.managers['ActionAlias'].match(alias_match) |
||
| 19 | return { |
||
| 20 | 'alias': _format_match(matches[0]), |
||
| 21 | 'representation': matches[1] |
||
| 22 | } |
||
| 31 |