Fix ranger plugin (#59)

Remove query prefix from ranger plugin
This commit is contained in:
Radu Ioan Fericean 2020-04-07 22:36:01 +03:00 committed by GitHub
parent 56218f35d3
commit f4cf811155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()
directory = output.strip()
self.fm.cd(directory)
self.fm.notify(directory)
else:
self.fm.notify("no match found", bad=True)
except subprocess.CalledProcessError as e:
if e.returncode == 1:
pass
except Exception as e:
self.fm.notify(e, bad=True)