mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
escape using helper function
This commit is contained in:
parent
8f8fd4231a
commit
57a1b3aca8
1 changed files with 7 additions and 6 deletions
|
|
@ -132,6 +132,11 @@ class FishPlugin(BeetsPlugin):
|
|||
with open(completion_file_path, 'w') as fish_file:
|
||||
fish_file.write(totstring)
|
||||
|
||||
def _escape(name):
|
||||
# Escape ? in fish
|
||||
if name == "?":
|
||||
name = "\\" + name
|
||||
|
||||
|
||||
def get_cmds_list(cmds_names):
|
||||
# Make a list of all Beets core & plugin commands
|
||||
|
|
@ -201,9 +206,7 @@ def get_subcommands(cmd_name_and_help, nobasicfields, extravalues):
|
|||
# Formatting for Fish to complete our fields/values
|
||||
word = ""
|
||||
for cmdname, cmdhelp in cmd_name_and_help:
|
||||
# Escape ? in fish
|
||||
if cmdname == "?":
|
||||
cmdname = "\\" + cmdname
|
||||
cmdname = _escape(cmdname)
|
||||
|
||||
word += "\n" + "# ------ {} -------".format(
|
||||
"fieldsetups for " + cmdname) + "\n"
|
||||
|
|
@ -236,9 +239,7 @@ def get_all_commands(beetcmds):
|
|||
names = [alias for alias in cmd.aliases]
|
||||
names.append(cmd.name)
|
||||
for name in names:
|
||||
# Escape ? in fish
|
||||
if name == "?":
|
||||
name = "\\" + name
|
||||
name = _escape(name)
|
||||
|
||||
word += "\n"
|
||||
word += ("\n" * 2) + "# ====== {} =====".format(
|
||||
|
|
|
|||
Loading…
Reference in a new issue