diff --git a/bdfr/completion.py b/bdfr/completion.py index 8f4f122..fac944f 100644 --- a/bdfr/completion.py +++ b/bdfr/completion.py @@ -26,16 +26,16 @@ class Completion: comp_dir = self.share_dir + "/fish/vendor_completions.d/" for point in self.entry_points: self.env[f"_{point.upper().replace('-', '_')}_COMPLETE"] = "fish_source" - with open(comp_dir + point, "w") as file: + with open(comp_dir + point + ".fish", "w") as file: file.write(subprocess.run([point], env=self.env, capture_output=True, text=True).stdout) - print(f"Fish completion for {point} written to {comp_dir}{point}") + print(f"Fish completion for {point} written to {comp_dir}{point}.fish") if self.shell in ("all", "zsh"): comp_dir = self.share_dir + "/zsh/site-functions/" for point in self.entry_points: self.env[f"_{point.upper().replace('-', '_')}_COMPLETE"] = "zsh_source" - with open(comp_dir + point, "w") as file: + with open(comp_dir + "_" + point, "w") as file: file.write(subprocess.run([point], env=self.env, capture_output=True, text=True).stdout) - print(f"Zsh completion for {point} written to {comp_dir}{point}") + print(f"Zsh completion for {point} written to {comp_dir}_{point}") def uninstall(self): if self.shell in ("all", "bash"): @@ -47,12 +47,12 @@ class Completion: if self.shell in ("all", "fish"): comp_dir = self.share_dir + "/fish/vendor_completions.d/" for point in self.entry_points: - if os.path.exists(comp_dir + point): - os.remove(comp_dir + point) - print(f"Fish completion for {point} removed from {comp_dir}{point}") + if os.path.exists(comp_dir + point + ".fish"): + os.remove(comp_dir + point + ".fish") + print(f"Fish completion for {point} removed from {comp_dir}{point}.fish") if self.shell in ("all", "zsh"): comp_dir = self.share_dir + "/zsh/site-functions/" for point in self.entry_points: - if os.path.exists(comp_dir + point): - os.remove(comp_dir + point) - print(f"Zsh completion for {point} removed from {comp_dir}{point}") + if os.path.exists(comp_dir + "_" + point): + os.remove(comp_dir + "_" + point) + print(f"Zsh completion for {point} removed from {comp_dir}_{point}")