Skip to content

Commit fc89b5e

Browse files
committed
Fix a bug involving completion of preview services. Fixes aws#309.
1 parent 48393fd commit fc89b5e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

awscli/completer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ def _complete_provider(self):
6363
def _complete_command(self):
6464
retval = []
6565
if self.current_word == self.command_name:
66-
retval = self.command_hc.command_table.keys()
66+
if self.command_hc:
67+
retval = self.command_hc.command_table.keys()
6768
elif self.current_word.startswith('-'):
6869
retval = self._find_possible_options()
6970
else:
7071
# See if they have entered a partial command name
71-
retval = [n for n in self.command_hc.command_table
72-
if n.startswith(self.current_word)]
72+
if self.command_hc:
73+
retval = [n for n in self.command_hc.command_table
74+
if n.startswith(self.current_word)]
7375
return retval
7476

7577
def _complete_subcommand(self):
@@ -123,7 +125,7 @@ def _process_command_line(self):
123125
self.command_name = w
124126
cmd_obj = self.main_hc.command_table[self.command_name]
125127
self.command_hc = cmd_obj.create_help_command()
126-
if self.command_hc.command_table:
128+
if self.command_hc and self.command_hc.command_table:
127129
# Look for subcommand name
128130
for w in self.non_options:
129131
if w in self.command_hc.command_table:

tests/unit/test_completer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
('aws s3 cp --quiet -', -1, set(['--no-guess-mime-type', '--dryrun',
6969
'--recursive', '--acl',
7070
'--exclude', '--include'] + GLOBALOPTS)),
71+
('aws emr ', -1, set([])),
7172
]
7273

7374

0 commit comments

Comments
 (0)