2021-01-05 17:05:55 +00:00
|
|
|
diff --git i/beets/ui/commands.py w/beets/ui/commands.py
|
2021-12-21 02:18:32 +00:00
|
|
|
index 3a337401..d08a6763 100755
|
2021-01-05 17:05:55 +00:00
|
|
|
--- i/beets/ui/commands.py
|
|
|
|
+++ w/beets/ui/commands.py
|
2021-12-21 02:18:32 +00:00
|
|
|
@@ -1759,21 +1759,6 @@ default_commands.append(config_cmd)
|
2021-01-05 17:05:55 +00:00
|
|
|
def print_completion(*args):
|
|
|
|
for line in completion_script(default_commands + plugins.commands()):
|
2021-12-21 02:18:32 +00:00
|
|
|
print_(line, end='')
|
2021-01-05 17:05:55 +00:00
|
|
|
- if not any(map(os.path.isfile, BASH_COMPLETION_PATHS)):
|
2021-12-21 02:18:32 +00:00
|
|
|
- log.warning('Warning: Unable to find the bash-completion package. '
|
|
|
|
- 'Command line completion might not work.')
|
|
|
|
-
|
2021-01-05 17:05:55 +00:00
|
|
|
-
|
|
|
|
-BASH_COMPLETION_PATHS = map(syspath, [
|
2021-12-21 02:18:32 +00:00
|
|
|
- '/etc/bash_completion',
|
|
|
|
- '/usr/share/bash-completion/bash_completion',
|
|
|
|
- '/usr/local/share/bash-completion/bash_completion',
|
2021-01-05 17:05:55 +00:00
|
|
|
- # SmartOS
|
2021-12-21 02:18:32 +00:00
|
|
|
- '/opt/local/share/bash-completion/bash_completion',
|
2021-01-05 17:05:55 +00:00
|
|
|
- # Homebrew (before bash-completion2)
|
2021-12-21 02:18:32 +00:00
|
|
|
- '/usr/local/etc/bash_completion',
|
2021-01-05 17:05:55 +00:00
|
|
|
-])
|
|
|
|
-
|
|
|
|
|
|
|
|
def completion_script(commands):
|
|
|
|
"""Yield the full completion shell script as strings.
|
|
|
|
diff --git i/test/test_ui.py w/test/test_ui.py
|
2021-12-21 02:18:32 +00:00
|
|
|
index 9804b0a1..c3b53243 100644
|
2021-01-05 17:05:55 +00:00
|
|
|
--- i/test/test_ui.py
|
|
|
|
+++ w/test/test_ui.py
|
2021-12-21 02:18:32 +00:00
|
|
|
@@ -1229,12 +1229,7 @@ class CompletionTest(_common.TestCase, TestHelper):
|
2021-01-05 17:05:55 +00:00
|
|
|
stdout=subprocess.PIPE, env=env)
|
|
|
|
|
|
|
|
# Load bash_completion library.
|
|
|
|
- for path in commands.BASH_COMPLETION_PATHS:
|
|
|
|
- if os.path.exists(util.syspath(path)):
|
|
|
|
- bash_completion = path
|
|
|
|
- break
|
|
|
|
- else:
|
2021-12-21 02:18:32 +00:00
|
|
|
- self.skipTest('bash-completion script not found')
|
|
|
|
+ self.skipTest('bash-completion script not found')
|
2021-01-05 17:05:55 +00:00
|
|
|
try:
|
|
|
|
with open(util.syspath(bash_completion), 'rb') as f:
|
|
|
|
tester.stdin.writelines(f)
|