From f4cf8111555406ac0b49e3fcbd88f3a12c552eec Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Tue, 7 Apr 2020 22:36:01 +0300 Subject: [PATCH] Fix ranger plugin (#59) Remove query prefix from ranger plugin --- ranger_zoxide.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ranger_zoxide.py b/ranger_zoxide.py index 7523d2c..f7d7e7a 100644 --- a/ranger_zoxide.py +++ b/ranger_zoxide.py @@ -25,14 +25,12 @@ class z(ranger.api.commands.Command): output = subprocess.check_output(["zoxide", "query"] + self.args[1:]) output = output.decode("utf-8") - query_prefix = "query: " - - if output.startswith(query_prefix): - directory = output[len(query_prefix) :].strip() - self.fm.cd(directory) - self.fm.notify(directory) - else: - self.fm.notify("no match found", bad=True) - + directory = output.strip() + self.fm.cd(directory) + self.fm.notify(directory) + except subprocess.CalledProcessError as e: + if e.returncode == 1: + pass except Exception as e: self.fm.notify(e, bad=True) +