Skip to content

Feature request: make it more scriptable either by limiting choice to the first or enabling exact name matching #298

@gfarrell

Description

@gfarrell

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:

  1. add an exact-match mode to the search query where the string name:France can only match the full name /^France$/;
  2. complicate (1) by adding regex syntax, supporting queries like the following: name:/^France$/;
  3. allowing the user to specify a --first flag 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions