mirror of
https://github.com/j1g5awi/krunner-vscode.git
synced 2024-12-22 18:36:00 +00:00
Add command to test matching
This commit is contained in:
parent
102abf38e1
commit
d1f3e15b0a
1 changed files with 15 additions and 3 deletions
|
@ -2,6 +2,8 @@ import difflib
|
|||
import json
|
||||
import os
|
||||
import sqlite3
|
||||
import sys
|
||||
from operator import attrgetter
|
||||
from pathlib import Path
|
||||
from typing import NamedTuple
|
||||
|
||||
|
@ -115,6 +117,16 @@ class Runner(dbus.service.Object):
|
|||
os.system("xdg-open " + data)
|
||||
|
||||
|
||||
runner = Runner()
|
||||
loop = GLib.MainLoop()
|
||||
loop.run()
|
||||
def main():
|
||||
runner = Runner()
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue