From 11ccc471bb91e19334fa266f9837f9bb09a1e34d Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Mon, 15 May 2023 16:07:54 +0200 Subject: contrib: add carddav-query script Add a standalone python script to allow querying contacts from a CardDAV compatible server. The script works with python 3.6+ and has no external dependencies. Link: https://sabre.io/dav/building-a-carddav-client/ Link: https://www.rfc-editor.org/rfc/rfc6352 Signed-off-by: Robin Jarry Tested-by: Tim Culverhouse --- doc/aerc-config.5.scd | 7 +++- doc/carddav-query.1.scd | 103 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 doc/carddav-query.1.scd (limited to 'doc') diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd index f092bfcf..af989045 100644 --- a/doc/aerc-config.5.scd +++ b/doc/aerc-config.5.scd @@ -550,7 +550,10 @@ These options are configured in the *[compose]* section of _aerc.conf_. This parameter can also be set per account in _accounts.conf_. - Example: + Example with *carddav-query*(1): + *address-book-cmd* = _carddav-query %s_ + + Example with *khard*(1): *address-book-cmd* = _khard email --remove-first-line --parsable %s_ *file-picker-cmd* = __ @@ -923,7 +926,7 @@ These options are configured in the *[templates]* section of _aerc.conf_. *aerc*(1) *aerc-accounts*(5) *aerc-binds*(5) *aerc-imap*(5) *aerc-maildir*(5) *aerc-notmuch*(5) *aerc-templates*(7) *aerc-sendmail*(5) *aerc-smtp*(5) -*aerc-stylesets*(7) +*aerc-stylesets*(7) *carddav-query*(1) # AUTHORS diff --git a/doc/carddav-query.1.scd b/doc/carddav-query.1.scd new file mode 100644 index 00000000..bdd708ab --- /dev/null +++ b/doc/carddav-query.1.scd @@ -0,0 +1,103 @@ +CARDDAV-QUERY(1) + +# NAME + +carddav-query - Query a CardDAV server for contact names and emails. + +# SYNOPSIS + +*carddav-query* [*-h*] [*-l* __] [*-v*] [*-c* __] +\[*-s* _
_] [*-k* __] [*-C* __] +\[*-s* __] [*-u* __] [*-p* __] __ [__ ...] + +This tool has been tailored for use as *address-book-cmd* in *aerc-config*(5). + +# OPTIONS + +*-h*, *--help* + show this help message and exit + +*-v*, *--verbose* + Print debug info on stderr. + +*-l* __, *--limit* __ + Maximum number of results returned by the server. If the server does not + support limiting, this option will be disregarded. + + Default: _10_ + +*-c* __, *--config-file* __ + INI configuration file from which to read the CardDAV URL endpoint. + + Default: _~/.config/aerc/accounts.conf_ + +*-S* _
_, *--config-section* _
_ + INI configuration section where to find __ and + __. By default the first section where __ + is found will be used. + +*-k* __, *--config-key-source* __ + INI configuration key to lookup in _
_ from __. The value + must respect the following format: + + https?://__[:__]@__/__ + + Both __ and __ must be percent encoded. If + __ is omitted, it can be provided via *--config-key-cred-cmd* + or *--password*. + + Default: _carddav-source_ + +*-C* __, *--config-key-cred-cmd* __ + INI configuration key to lookup in _
_ from __. The value + is a command that will be executed with *sh -c* to determine + __ if it is not present in __. + + Default: _carddav-source-cred-cmd_ + +*-s* __, *--server-url* __ + CardDAV server URL endpoint. Overrides configuration file. + +*-u* __, *--username* __ + Username to authenticate on the server. Overrides configuration file. + +*-p* __, *--password* __ + Password for the specified user. Overrides configuration file. + +# POSITIONAL ARGUMENTS + +__ + Search term. Will be used to search contacts from their FN (formatted + name), EMAIL, NICKNAME, ORG (company) and TITLE fields. + +# EXAMPLES + +These are excerpts of _~/.config/aerc/accounts.conf_. + +## Fastmail + +``` +[fastmail] +carddav-source = https://janedoe%40fastmail.com@carddav.fastmail.com/dav/addressbooks/user/janedoe@fastmail.com/Default +carddav-source-cred-cmd = pass fastmail.com/janedoe +address-book-cmd = carddav-query -S fastmail %s +``` + +## Gmail + +``` +[gmail] +carddav-source = https://johndoe%40gmail.com@www.googleapis.com/carddav/v1/principals/johndoe@gmail.com/lists/default +carddav-source-cred-cmd = pass gmail.com/johndoe +address-book-cmd = carddav-query -S gmail %s +``` + +# SEE ALSO + +*aerc-config*(5) + +# AUTHORS + +Created by Robin Jarry who is assisted by other open source +contributors. For more information about aerc development, see +https://sr.ht/~rjarry/aerc/. -- cgit