Add warning if completion package not found

This commit is contained in:
Thomas Scholtes 2014-02-27 18:16:02 +01:00
parent 8450d51bab
commit 74cb897f79

View file

@ -1292,7 +1292,14 @@ default_commands.append(write_cmd)
completion_cmd = ui.Subcommand('completion',
help='print shell script that provides command line completion')
def print_completion(*args):
if not (os.path.isfile(u'/etc/bash_completion') or
os.path.isfile(u'/usr/share/bash-completion/bash_completion') or
os.path.isfile(u'/usr/share/local/bash-completion/bash_completion')):
log.warn(u'Warning: Unable to find the bash-completion package. '
u'Command line completion might not work.')
for line in completion_script(default_commands):
print(line, end='')
completion_cmd.func = print_completion
default_commands.append(completion_cmd)