[docs]classFishComplete(DjangoTyperShellCompleter):""" This completer class supports the fish_ shell. Completion scripts are installed in the ``~/.config/fish/completions`` directory. Returned suggestions are formatted as ``type,value[\thelp]``. Each suggestion is on one line and if no help is provided, the help text including the tab delimiter is omitted. """name="fish"""" shell executable. """template="shell_complete/fish.fish"""" The template used to render the fish completion script. """supports_scripts=False""" Fish does not support script invocations. """color=False""" Fish does not support ansi control codes. """defget_user_profile(self)->Path:""" Get the user's fish config file. It is located in the user's home directory by default unless the ``XDG_CONFIG_HOME`` environment variable is set. """return(Path(os.environ.get("XDG_CONFIG_HOME",Path.home()/".config"))/"fish/config.fish")@cached_propertydefinstall_dir(self)->Path:install_dir=self.get_user_profile().parent/"completions"install_dir.mkdir(parents=True,exist_ok=True)returninstall_dirdefformat_completion(self,item:CompletionItem)->str:ifitem.help:return(f"{item.type},{self.process_rich_text(item.value)}\t"f"{self.process_rich_text(item.help)}")returnf"{item.type},{self.process_rich_text(item.value)}"definstall(self,prompt:bool=True)->t.List[Path]:assertself.prog_namescript=self.install_dir/f"{self.prog_name}.fish"source=self.source()ifself.prompt(prompt=prompt,source=source,file=script):script.write_text(source)return[script]return[]defuninstall(self):assertself.prog_namescript=self.install_dir/f"{self.prog_name}.fish"ifscript.is_file():script.unlink()