mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
fish plugin: Assign the default output path to the option instead of using None
This commit is contained in:
parent
b46b4d2045
commit
fedb8b0b8f
1 changed files with 3 additions and 8 deletions
|
|
@ -84,7 +84,7 @@ class FishPlugin(BeetsPlugin):
|
|||
cmd.parser.add_option(
|
||||
'-o',
|
||||
'--output',
|
||||
default=None,
|
||||
default='~/.config/fish/completions/beet.fish',
|
||||
help='save the script to a specific file, by default it will be'
|
||||
'saved to ~/.config/fish/completions')
|
||||
return [cmd]
|
||||
|
|
@ -96,13 +96,8 @@ class FishPlugin(BeetsPlugin):
|
|||
# Make a giant string of all the above, formatted in a way that
|
||||
# allows Fish to do tab completion for the `beet` command.
|
||||
|
||||
completion_file_path = opts.output
|
||||
if completion_file_path is not None:
|
||||
completion_dir = os.path.dirname(completion_file_path)
|
||||
else:
|
||||
home_dir = os.path.expanduser("~")
|
||||
completion_dir = os.path.join(home_dir, '.config/fish/completions')
|
||||
completion_file_path = os.path.join(completion_dir, 'beet.fish')
|
||||
completion_file_path = os.path.expanduser(opts.output)
|
||||
completion_dir = os.path.dirname(completion_file_path)
|
||||
|
||||
if completion_dir != '':
|
||||
os.makedirs(completion_dir, exist_ok=True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue