Last active
August 29, 2015 14:21
-
-
Save tkuchiki/66f83c22fdd7d03c62a2 to your computer and use it in GitHub Desktop.
patching file awscli/completer.py(https://github.com/aws/aws-cli)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -34,6 +34,9 @@ | |
self.non_options = None | |
def _complete_option(self, option_name): | |
+ if option_name == '--color': | |
+ cli_data = self.driver.session.get_data('cli') | |
+ return cli_data['options']['color']['choices'] | |
if option_name == '--endpoint-url': | |
return [] | |
if option_name == '--output': | |
@@ -47,9 +50,12 @@ | |
retval = [] | |
if self.current_word.startswith('-'): | |
cw = self.current_word.lstrip('-') | |
- l = ['--' + n for n in self.main_options | |
- if n.startswith(cw)] | |
- retval = l | |
+ if cw in ['color', 'endpoint-url', 'output', 'profile']: | |
+ retval = self._complete_option('--' + cw) | |
+ else: | |
+ l = ['--' + n for n in self.main_options | |
+ if n.startswith(cw)] | |
+ retval = l | |
elif self.current_word == 'aws': | |
retval = self._documented(self.main_hc.command_table) | |
else: | |
@@ -153,6 +159,15 @@ | |
point = len(cmdline) | |
self.point = point | |
self._process_command_line() | |
+ | |
+ if self.previous_word is not None and self.previous_word.startswith('-'): | |
+ if self.previous_word in ['--color', '--output', '--profile']: | |
+ options = self._complete_option(self.previous_word) | |
+ retval = [] | |
+ for opt in options: | |
+ if opt.startswith(self.current_word): | |
+ retval.append(opt) | |
+ return retval | |
if not self.command_name: | |
# If we didn't find any command names in the cmdline | |
# lets try to complete provider options |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment