Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom address templates #205

Open
madduck opened this issue Feb 5, 2019 · 2 comments
Open

Custom address templates #205

madduck opened this issue Feb 5, 2019 · 2 comments
Labels
enhancement interface changes the user interface in a non trivial way
Milestone

Comments

@madduck
Copy link

madduck commented Feb 5, 2019

Using the postaladdress command, khard can print an address suitable for printing onto an envelope. But this only really works for some European countries, because the format for post address in most countries of the world differs in that the postal code usually follows city.

It would be great if khard could provide different templates to select from, possibly even make it such that the default template is chosen heuristically by looking at the country subfield.

@lucc
Copy link
Owner

lucc commented Mar 9, 2019

I would say that this is a special case of the ideas in #89 about formatting display names and #179
about formatting the output of listing commands in general. The general solution to all this would be the possibility to provide format strings to make the output controllable by the user. The only issue I always had when thinking about simple date(1) or printf like format strings (but rather in the syntax of pythons str.format()) is the alignment in table like outputs that we have in many places.

@lucc lucc added this to the v1.0 milestone Jun 21, 2019
@lucc lucc added the interface changes the user interface in a non trivial way label Aug 21, 2019
@lucc
Copy link
Owner

lucc commented Apr 7, 2020

For users who are interested in scripting a custom post address format themselfs you can try one of these ways:

  1. Use khard list --fields "...." --parsable to generate output suitable for further processing with awk or so. This prints multible contacts.
  2. Use khard show --format=yaml and generate output in yaml format that can be piped to any yaml parser for further processing. For example python + ruamel.yaml. This prints only one contact at a time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement interface changes the user interface in a non trivial way
Projects
None yet
Development

No branches or pull requests

2 participants