-
Notifications
You must be signed in to change notification settings - Fork 68
Description
I wrote a script for khard so I can use it easily with Rofi (mimicking the functionality I used to have in Alfred when I was on macOS). The problem with this is that sometimes there are two contacts with names which cause a collision (e.g. my house in France is called "France", and I have a friend with the last name "Frances"). This causes my script to hang as khard wants interactive input. I've tried adding the UID into the list and then just selecting that with awk, but only a short UID is printed, so there are still multiple results when using khard show "uid:XXX".
I can think of three ways of making khard more scriptable:
- add an exact-match mode to the search query where the string
name:Francecan only match the full name/^France$/; - complicate (1) by adding regex syntax, supporting queries like the following:
name:/^France$/; - allowing the user to specify a
--firstflag which just picks the closest match (khard show --first "name:France").
In fact, to make this completely scriptable, (3) is always necessary as two records might have the same names, but it's unlikely.
I'm happy to implement this and open a PR with (a) a bit of input on the best option; (b) a pointer as to where to start in the codebase.