diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 42b06c5d5..fe03cc1a4 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -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)