1
Fork 0
mirror of https://github.com/j1g5awi/krunner-vscode.git synced 2024-11-22 10:09:30 +00:00

Add command to test matching

This commit is contained in:
Jake Howard 2023-05-14 18:00:35 +01:00
parent 102abf38e1
commit d1f3e15b0a
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -2,6 +2,8 @@ import difflib
import json import json
import os import os
import sqlite3 import sqlite3
import sys
from operator import attrgetter
from pathlib import Path from pathlib import Path
from typing import NamedTuple from typing import NamedTuple
@ -115,6 +117,16 @@ class Runner(dbus.service.Object):
os.system("xdg-open " + data) os.system("xdg-open " + data)
runner = Runner() def main():
loop = GLib.MainLoop() runner = Runner()
loop.run() if sys.argv[1:]:
# Manual search - useful for local testing
for match in sorted(runner.Match(sys.argv[1]), key=attrgetter("relevance")):
print(match.data, match.relevance)
else:
loop = GLib.MainLoop()
loop.run()
if __name__ == "__main__":
main()