henrycatalinismith / ppl Goto Github PK
View Code? Open in Web Editor NEWThe command line address book
Home Page: http://henry.catalinismith.com/ppl/
License: Other
The command line address book
Home Page: http://henry.catalinismith.com/ppl/
License: Other
Hi
While I love using the command line, syncing several hundred vcard files with a smartphone is not exactly the thing I want to spend my spare time with. Thus, I'd love to have it sync with gmail, so my smartphone can easily access it too.
Benedikt Müller
Hi!
First of all, thank you very much for this nice script!
When I was importing my previous address book, of course stored as UTF-8 plaintext vcf, to ppl, I realized that contacts containing non-ascii characters are not parsed, and ppl complains with:
ppl: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
In my case the character ppl could not digest was the character 'ß', which is very common in German addresses, for it's part of the German word for street, "Straße". For now I worked around this issue, by setting:
RUBYOPT="-E ASCII-8BIT"
Obviously this is not the correct way to deal with this issue, so please fix it in the ppl source.
Might as well tidy this up too while postal addresses are in the spotlight. At the moment, once an attribute of an address is set, it's set in stone. Users need to be able to delete address attributes like so.
$ ppl post bob work --country "United Kingdom" # add
$ ppl post bob work --country "" # remove
When I installed ppl the current working directory for my shell was a directory within a git repository of a project I was working on. I initialized an address books and added my first contact and found that the .vcf was created in the current working directory and committed to my project rather than ppl's git repo that I'd created in ~/contacts. I'm not sure if this is the expected behavior. I tried in a non git directory and it created it there as well. It seems like it would be better not to have to change directory into the address book each time.
I've had a change of heart since Issue #31 where I said that
The vCard format's ADR property does support a TYPE parameter, but I'm wary of misappropriating it as a unique identifier.
I overcame my concerns about this. It's a bit of an unfortunate split with the vanilla vCard spec, but I think it's one that's necessary in order to provide a palatable CLI experience. This is how ppl post is gonna work.
$ ppl post bob
* home 1 Testing Road, London, UK, SW1 2PO
work BigCorp Industries, 4th Floor, Business Building, London, SW2 9EE
$ ppl post bob home --postcode "SW1 2PQ"
$ ppl post bob word --delete
The workaround for ADR
fields that lack a TYPE
is to give them a placeholder ID based on the SHA1 hash of the address data itself. This will make for ugly IDs for those with legacy pre-2.0.0 postal addresses as well as those importing from other sources. So people need to be able to change these IDs.
I just ran into this issue installing the ppl
gem on Debian unstable, and thought it was worth documenting the solution. The full error was as follows.
$ sudo gem install ppl
Fetching: inifile-2.0.2.gem (100%)
Fetching: rugged-0.17.0.b6.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing ppl:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/rugged-0.17.0.b6 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/rugged-0.17.0.b6/ext/rugged/gem_make.out
The cause of this problem is a missing dependency: the ruby1.9.1-dev
package. The solution is to install it and try again.
sudo apt-get install ruby1.9.1-dev
sudo gem install ppl
If I try to save a contact from mutt with a ›special character‹ in the name I get the following question
Add "=?utf-8?q?XX=C5=99XXXX=C3=A1?=<#<Ppl::Entity::EmailAddress:0x000000034d92e0>>" to your address book [Y/n]?
and as you can image the resulting filename is quite difficult to handle in the filesystem. (I used »X« to hide the name of the contact I am trying to save. In this case, the letter that is causing a problem is a »ř« which is used in Czech. Of course, it's a quite exotic letter but I had similar problems with a simple »é«.) Isn't it possible to replace special characters with a replacement character to ensure that there are no problems when saving the file?
(I'm sorry, I would like to do a push request but, unfortunately, my knowledge of Ruby is rather limited=not existent.)
At this time the config files are stored in ~/.pplconfig
but it would be better if that could be changed to something like ~/.config/ppl/
.
In other words: ppl should respect the XDG specs and that would make it really modern and awesome™.
$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.
I'm not a programmer as such, so I just sharing the idea. There's probably a straightforward Ruby tool for this, or otherwise, maybe a Python script could be written?
I think it would be useful to export birthdays using ppl, not just because you can write a title like firstname's birthday but mainly because you can have the complete contact info in the description. Also, one of the reasons I like ppl is because I'm too stupid to get the age of a person on his/her birthday right :) A recurring event won't help me be confident about the age per se, unless I also write a short table of dates and ages to the description as a mnemonic.
On a related note, and i haven't tried it: to be notified for a birthday using birthday one could simply write bd name=DD/MM/YYYY
to ~/.birthdays
. It's probably easy to use ppl's bang alias feature for that.
ppl
sets the vCard name (N
) property to the same value as the contact ID. For example:
$ ppl add johnd "John Doe"
Will result in a vCard such as:
BEGIN:VCARD
VERSION:3.0
N:;johnd;;;
FN:John Doe
...
I've began to populate the contacts on my Android phone with the vCards from ppl
. The problem is that Android lists the contacts by the N
property. There seems to be no way to tell it to use the FN
property. (This sort of makes sense, since, unlike N
, the value of FN
isn't split into first and last name segments. The value of N
is supposed to be more structured.) The result is that all the contacts on my phone appear as johnd
and the like.
A short name like johnd
makes sense when interacting with contacts in a command-line interface like that provided by ppl
. I do not think it makes sense for a graphical interface. In a graphical interface, the standard "First Name Last Name" display is preferred (with the option of switching that to "Last Name, First Name" of course).
I would rather ppl
populate the N
property based on the contact's full name. For example:
$ ppl add johnd "John Doe"
Will result in a vCard such as:
BEGIN:VCARD
VERSION:3.0
N:Doe;John;;;
FN:John Doe
...
This behaviour would make the contacts display properly on my phone. It would also match the behaviour of other contact applications (for example, vCard exports from Gmail). And it would better match the vCard specification, which says that the purpose of N
is "to specify the components of the name of the object the vCard represents". Currently ppl
does not use the N
property to specify the components of the contact's name.
This is the last issue that is preventing me from fully migrating from abook to ppl!
abook has an --add-email
argument. According to the man page:
--add-email
Read an e-mail message from stdin and add the sender to the addressbook.
In my ~/.muttrc
I use it like this:
# Add sender to address book
macro index,pager a "<pipe-message>abook --add-email<return>"
When I'm on a message in Mutt I hit the a
key. I'm then prompted if I want to add the sender to abook.
Add "John Doe <[email protected]>" to /home/user/.addressbook? (y/n)
I'm prompted like this for every sender found in the message. This includes the sender set in the header, but if it is a forwarded message it also includes the sender of the original message.
If I hit 'y', a new contact is added to my address book with a name of "John Doe" and an email of "[email protected]".
If the message did not have a proper From:
header set with the sender's name, the prompt would look like this:
Add "[email protected] <[email protected]>" to /home/user/.addressbook? (y/n)
If I selected 'y' the new contact would then have a name of "[email protected]".
Adding this functionality would expand the scope of ppl from just managing contacts to also scraping messages. I understand if you do not want to go down that road. It may make more sense just to write a small, separate script that does the scraping and passes the results to ppl.
I know it's bad habit to use special characters in file names. But sometimes import-/export-tools create file names with non-english characters.
The problem is that ppl crashes with these file names.
STEPS TO REPRODUCE
-) copy paste this to your console: ppl add franz_viehböck "Franz Viehböck"
-) when running ppl ls
you will get this error: ppl: incompatible character encodings: ASCII-8BIT and UTF-8
NOTE
if you add the contact with this command ppl add franz_viehboeck "Franz Viehböck"
(still special character in the name but not in the contact descriptor) you don't have any problems.
I would like to see full UTF-8 support for file names (or <contact>
fields as you call them)
I faced the following error when trying to install the gem.
sudo gem install ppl Password: ERROR: While executing gem ... (NoMethodError) undefined method 'call' for nil:NilClass
Ruby version: ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
OS: Mac OS X - Mountain Lion
Any suggestions on how to overcome this error and install ppl?
Thanks,
[crunchbang5010:storge] ~ $ sudo apt-get install rubygems git
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version.
rubygems is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
[crunchbang5010:storge] ~ $ sudo gem install ppl
Successfully installed ppl-1.0.1
1 gem installed
Installing ri documentation for ppl-1.0.1...
Installing RDoc documentation for ppl-1.0.1...
[crunchbang5010:storge] ~ $ ppl init ~/contacts
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require': no such file to load -- rugged (LoadError) from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in
require'
from /var/lib/gems/1.8/gems/ppl-1.0.1/lib/ppl/adapter/storage/git.rb:2
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require' from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in
require'
from /var/lib/gems/1.8/gems/ppl-1.0.1/lib/ppl.rb:30
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require' from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in
require'
from /var/lib/gems/1.8/gems/ppl-1.0.1/bin/ppl:8
from /usr/local/bin/ppl:23:in `load'
from /usr/local/bin/ppl:23
[crunchbang5010:storge] ~ $
...so that's pretty much all i know.
...i don't know what other detail you might require.
[crunchbang5010:storge] ~ $ cat /etc/debian_version
wheezy/sid
[crunchbang5010:storge] ~ $ cat /proc/version
Linux version 3.6.0-10.dmz.1-liquorix-amd64 (Debian 3.6.0-10) ([email protected]) (gcc version 4.7.2 (Debian 4.7.2-4) ) #1 ZEN SMP PREEMPT Wed Dec 12 03:35:17 UTC 2012
...this is my first bur report in ages, and my first on git hub. i hope i didn't do it too poorly.
I think it would be neat if I could customize the fields that are displayed in the output of ppl ls
. I ran into a scenario yesterday where this would have been useful.
For example, let's say I'm just interested in names and phone numbers. I could do something like this:
$ ppl ls --name --phone
Or if I wanted to get all email addresses for contacts that belong to the organization "family", I could use this feature combined with grep
.
$ ppl ls --name --email --org | grep family
It'd also be cool if I could set the default ls
fields in ~/.pplconfig
.
As a temporary workaround for full sync capability (to gmail, icloud etc.) is it safe or reasonable to host the contacts database on a DropBox drive?
I have hosted Git repos in this way before, but they can be a bit temperamental when accessed from multiple computers.
several people i know--myself included--have more than one email address.
my first thought was to just make multiple ppl for someone.
ppl add kevin "[email protected]"
ppl org kevin "home"
ppl add kevin2 "[email protected]"
ppl org kevin2 "work"
it works well enough for me.
but the reason i went ahead and posted this, is that now that i see axelGschaider talking about nucky, i started thinking that i'd like being able to add more than one email to a contact--especially if they are ever able to be synced. i have some individual android gmail contacts with 3 emails and 3 phone numbers! I know that's outlier, but i think there are enough people with two or more emails and phone numbers that it's bound to come up at some point.
...but that seems like a fair amount of increase in complexity for you and ...well its just a request :)
i'm happy to report i have about 100 ppl contacts already. i just integrated my gmail with mutt in the yesterday, and i'm about to post this here and go look at goobook (for gmail contacts in mutt) and see where things overlap or are lacking. unfortunately i'm not much of a programmer, so i'm sort of looking at it from the geeky user perspective.
The instructions read:
$ ppl completion zsh | sudo tee /usr/share/zsh/site-functions/
This should be:
$ ppl completion zsh | sudo tee /usr/share/zsh/site-functions/_ppl
Note the lack of filename on the top version, which results in an error:
tee: /usr/share/zsh/site-functions/: Is a directory
It would be nice that ppl fred
was equivalent to ppl show fred
Currently these failed operations exit with 0
or die with some unintelligible fatal error message.
This is a pretty substantial behavioural change. The following need updating.:
This is really low priority but are you considering a shell command, like the one taskwarrior has?
In taskwarrior this is only a loop that, in case of longer sessions, relieves me from having to prepend 'task' (in this case it's 'ppl') every time.
In the long run tab completion might be a nice idea. But obviously that would be much more complex.
All the other formatters are done. The only one that's missing is the one for "maximum zoom" inspection of an individual address, e.g. when the user types this.
$ ppl post bob home
???
???
???
If all else fails, stick with the old "Name: Value\n" list of old.
I've written a ZSH completion function for ppl
. I'm not sure what the best way to distribute this would be. For now it is a gist:
https://gist.github.com/pigmonkey/5367403
It completes commands. When a command expects an existing contacts (ie email
but not add
), it will complete nicknames. This should provide the feature requested in #8.
Currently it does not complete arguments. I just dived into writing ZSH completions this afternoon and I haven't been able to figure out how to make it complete -d
/--delete
only on appropriate commands, or allow for the various post
arguments.
To install, it should be saved as _ppl
somewhere in your $fpath
. Oh-my-zsh users can place it in the $ZSH/completions/_ppl
.
This could really wait until post-2.0.0, but I might as well get it in there from the outset. It needs to work exactly the same as the existing --preferred
functionality in commands like ppl email
As of 1.22.1
I cannot delete phone numbers with -d/--delete
.
ppl scrape
should check to see if the email address that it scraped already exists somewhere in my contact list.
Right now it adds a new contact with the id $firstname_$lastname
, even though I already have a contact with the id $lastname
with that email.
If I have already have a contact with the id $firstname_$lastname
, the scrape
command completely overwrites the contact (removing any phone number or postal addresses).
first question: is there a way i can move contacts made in the wrong dir to the address book?
i made a mistake and entered about 50 contacts outside of my address book. i tried to move all the $name.vcf into ~/contacts and tried 'ppl ls' but it listed only the two contacts i had in there previously.
second question: what goes in this [bracket] below?
$ echo "[address book]" > ~/.pplconfig
$ echo path = "`pwd`" >> ~/.pplconfig
i tried to do this:
$ echo "~/contacts" > ~/.pplconfig
but at my next attempt to create a contact, this happened:
[crunchbang5010:storge] ~/contacts $ ppl add test2 "testy mctest"
[crunchbang5010:storge] ~/contacts $ echo "~/contacts" > ~/.pplconfig
[crunchbang5010:storge] ~/contacts $ echo path = "`pwd`" >> ~/.pplconfig
[crunchbang5010:storge] ~/contacts $ ppl add test3 "testy mctest"
/var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:506:in `parse_error': Could not parse line: "~/contacts" (IniFile::Error)
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:482:in `process_property'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:434:in `parse!'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:148:in `read'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:91:in `initialize'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:35:in `new'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:35:in `load'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/configuration.rb:40:in `user_configuration'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/configuration.rb:11:in `address_book_path'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:67:in `storage_adapter'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:23:in `block in commands'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:22:in `each'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:22:in `commands'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:30:in `command_suite'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:53:in `router'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:60:in `shell'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/bin/ppl:13:in `'
from /usr/local/bin/ppl:23:in `load'
from /usr/local/bin/ppl:23:in `'
[crunchbang5010:storge] ~/contacts
...on balance, the first question matters more to me, since it was a lesson learned to be in the right directory the first time. but knowing the second question will save me in the future.
thanks again.
~storge
EDIT
Hey,
Has anyone else out there found that ppl generally takes a few hundred milliseconds longer to execute than they'd like? I primarily use ppl on two different computers: one with an SSD, and one with a regular spinning platter hard-drive. Paradoxically, I find that ppl runs like a sick old horse on the machine with the SSD, and comparatively quickly on the one with the regular hard-drive.
Check out this fairly typical SSD running time:
$ time ppl > /dev/null
real 0m1.817s
user 0m1.696s
sys 0m0.112s
That's almost two seconds! And it's just the plain ppl
command which displays the help text! In fact, look what happens if I run ppl ls
!
$ time ppl ls > /dev/null
real 0m2.376s
user 0m2.292s
sys 0m0.076s
Over two seconds! I'll amend this issue with some figures from the machine with the regular hard-drive as soon as possible, but in the meantime, is anybody else suffering with performance as poor as this?
~ [ sudo ppl ] 12:21 AM
/Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/adapter/storage/git.rb:13:in `new': Could not find repository from '/Users/halid' (Rugged::RepositoryError)
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/adapter/storage/git.rb:13:in `initialize'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/adapter/storage/factory.rb:17:in `new'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/adapter/storage/factory.rb:17:in `load_adapter'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/application/bootstrap.rb:69:in `storage_adapter'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/application/bootstrap.rb:23:in `block in commands'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/application/bootstrap.rb:22:in `each'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/application/bootstrap.rb:22:in `commands'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/application/bootstrap.rb:30:in `command_suite'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/application/bootstrap.rb:53:in `router'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/gems/ppl-1.6.0/lib/ppl/application/bootstrap.rb:60:in `shell'
from /Users/halid/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/gems/1.9.1/gems/ppl-1.6.0/bin/ppl:13:in `<top (required)>'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/bin/ppl:19:in `load'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/bin/ppl:19:in `<main>'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/halid/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in `<main>'
What should I do?
One thing I've found missing from ppl is the ability to search (outside of Mutt).
I'd like to be able to do something like:
$ ppl search john
jdoe: John Doe <[email protected]>
jsmith: John Smith <[email protected]>
mjohn: Matthew John <[email protected]>
Or even fuzzier:
$ ppl search jo
jdoe: John Doe <[email protected]>
jsmith: John Smith <[email protected]>
jj: Joe Johnson <[email protected]>
I have a lot of contacts, and I don't always remember everybody's id, which usually results in me running ppl ls | grep jo
which works, but isn't as elegant, and I'm assuming not as fast as it could be.
What do you think?
I'm not a Ruby guy, so I don't know if this is a ppl issue or a problem with this vpim thingy.
$ ppl init ~/contacts
/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': /usr/lib/ruby/gems/2.0.0/gems/vpim-0.695/lib/vpim/vcard.rb:678: invalid multibyte escape: /^\xFE\xFF/ (SyntaxError)
invalid multibyte escape: /^\xFF\xFE/
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/lib/ruby/gems/2.0.0/gems/ppl-1.15.0/lib/ppl/adapter/vcard/vpim.rb:2:in `<top (required)>'
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/lib/ruby/gems/2.0.0/gems/ppl-1.15.0/lib/ppl.rb:34:in `<top (required)>'
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/lib/ruby/gems/2.0.0/gems/ppl-1.15.0/bin/ppl:8:in `<top (required)>'
from /usr/bin/ppl:23:in `load'
from /usr/bin/ppl:23:in `<main>'
$ ruby --version
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
I don't know the complete philosophy behind it but the tab completion feature of ppl for entry IDs (i.e. "alice" and "bob" in your quickstart example) gives me the id plus a trailing ".vcf" that I have to remove manually.
I guess the tab completion would really shine if the ".vcf" was removed.
I wanted to add different/costume attributes to some contacts. Any thought about adding this?
I've found myself wanting to indicate a contact's spouse. The vCard spec seems to support this with the RELATED property. It'd be cool if I could do something like this:
$ ppl add adam "Adam Doe"
$ ppl add eve "Eve Doe"
$ ppl relatated adam eve -t spouse
This would add Eve as a relation of type spouse
in Adam's vCard. For relations like spouse
that are 1:1, it could also add Adam as a spouse to Eve's entry.
Other relations are not 1:1.
$ ppl add fred "Fred Doe"
$ ppl related fred adam -t parent
This would add Adam as a parent to Fred's entry. It may be a little much for ppl to also add Fred as a child to Adam's entry. But perhaps ppl could add Fred as a relation in Adam's entry, without specifying any type.
I assume that the actual relation value in the vCard would be the UUID of the specified contact ID.
But there's more! In some instances I simply want to make a note of the contact's spouse's name. I don't actually have any unique contact information for the spouse, so it doesn't necessarily make sense to create a new contact for the spouse and link the two. The vCard spec says that a relation can be a simple text entry. So perhaps ppl related
should look to see if the passed value is a valid contact ID. If it is, it adds the value as the UUID of the contact ID. If it isn't a valid contact, it just adds the value as a text entry.
For example, this:
$ ppl add barney "Barney Rubble"
$ ppl related barney "Betty Rubble" -t spouse
There is no contact for Betty, so this would add an entry to Barney's vCard that looks something like this:
RELATED;TYPE=spouse;VALUE=text:Betty Rubble
At some point the user should be hinted as how to leave the shell mode. Yes, "exit" is rather obvious but it would be nice not to have to try :)
This is the last thing before this thing becomes shippable. Gotta get some automated behavioural testing in place.
I ran across two problems while trying to import my contacts.vcf file from Google Contacts into ppl.
^M
characters ending fields. Trying to run ppl ls
if even one of your contact cards has these characters in it leads to scrambled output from the offending card, with no other indication of what the problem might be and no list to speak of.This project is definitely something I've been needing, so I'd be more than happy to try and put a Ruby solution together for these problems. But, like I said, I'm pretty amateur at GitHub and Ruby still, so am definitely not the best choice if this is something people would like implemented quickly.
First, great program! I love it. Second, could it be that only the email addresses are searched when I am querying the program through mutt? This is a bit enoying when people are using nicknames and I can't remember them -- and actually an address book should turn in and tell me the right email address. :-)
I would prefer it if Mutt queries were case insensitive.
Currently, if I have a contact joe
whose name is "Joe Schmoe", I can find him if I use the correct capitalization.
$ ppl mutt Schmoe
Searching address book... 12 entries... 1 matching:
[email protected] Joe Schmoe
If I use incorrect capitalization, he isn't found. In Mutt my habit is to use all lowercase with the query command (one less keystroke!).
$ ppl mutt schmoe
Searching address book... 12 entries... 1 matching:
No matches
The lack of this functionality is occasionally annoying. ppl post ought to work like email and phone somehow, so that contacts can have more than one postal address each.
The only thing standing in the way of this right now is my uncertainty regarding unique identifiers for postal addresses. In order to store multiple addresses, there needs to be a way to identify each address uniquely like so:
$ ppl post bob <unique-identifier> --country Afghanistan
For phone numbers and email addresses, the data is its own unique identifier, and that seems to work just fine. Postal addresses are composed of several pieces of data, so that approach doesn't work for them.
The vCard format's ADR
property does support a TYPE
parameter, but I'm wary of misappropriating it as a unique identifier. In RFC2426, the example usage of TYPE
suggests more of a "list of tags" usage than anything else:
ADR;TYPE=dom,home,postal,parcel:;;123 Main Street;Any Town;CA;91921-1234
Another option would be ordering the addresses lexicographically and giving each one a number based on its position in that list.
$ ppl post bob
1. 3701 Southwest 12th Street, Topeka, Kansas, USA
2. 350 5th Avenue, New York City, New York, USA, 10118
$ ppl post bob --delete 2
$ ppl post bob
1. 3701 Southwest 12th Street, Topeka, Kansas, USA
But this has the potential to create quite a confusing user experience. For example, consider what would have happened in the above example if the user instead ran ppl post bob --delete 1
. The address that used to be 2
would now be 1
, and unless they re-ran the ppl post bob
command this would not be clear. The confusion would increase exponentially the more postal addresses the contact had.
Despite the above concerns, that number-based unique identifier is the best I've been able to come up with so far.
The vCard specification includes a PREF
type that can be added to email and phone entries to specify the preferred address or number. It would be great if ppl could support this.
If a phone has the PREF
type, ppl could put it at the top of the list of phone numbers in the output of ppl show ...
. Or perhaps ppl should prepend a special character to it, such as *
.
If an email has the PREF
type, ppl should display it in <
/>
next to the contact's name in the output of ppl show ...
, as well as being ordered or displayed in the list of email addresses the same as the preferred phone number is displayed in its list.
The preferred email could be specified like this:
$ ppl email jdoe --preferred [email protected]
This would check if the email [email protected] already exists for jdoe
. If it does, it would set its type to PREF
(and remove the PREF
type from any other emails, if it exists). If it does not exist, it would add the email and set the type to PREF
. The same behaviour could be used for adding or specifying the preferred phone number.
First of all: great piece of software. Exactly what I was looking for!
While I really like the concept of using git for sync, one thing that is still missing is the ability to sync to smartphones. Here vdirsyncer ( https://github.com/untitaker/vdirsyncer ) could do the trick.
From a quick check it seems to me, that a "vdir" is basically the same as ppl's storage backend with the names of the vcf-files being some UID string.
Just a note that an issue has been found and fixed where email addresses were saved twice by the ppl email command. For example, the following steps would lead to the address "[email protected]" appearing twice in the list of email addresses for the contact "arnold":
$ ppl init ~/contacts
$ cd ~/contacts
$ ppl add arnold "Arnold Example User"
$ ppl email arnold [email protected]
$ ppl email arnold
[email protected]
[email protected]
This bug was due to an accidental repeated call to encode_email_addresses
in Ppl::Adapter::Vcard::Vpim#encode. The bug has been fixed in version 1.6.0
, so upgrade to that version if you're affected and want to fix it.
If you want to clean up your data, I've also allowed the ppl email --delete
action to jump the queue of other features and implemented it already. So as of 1.6.0
, if you want to fix duplicate contact addresses for contacts such as our example arnold above, do the following:
$ ppl email arnold --delete [email protected]
$ ppl email arnold [email protected]
That's all!
Most of my contacts have multiple phone numbers. I need some way to keep straight which is which. Currently I'm adding them like this:
$ ppl phone jdoe "1115551234 (work)"
$ ppl phone jdoe "1115556789 (cell)"
This works fine, but the vCard specification does include telephone types. As seen in the Wikipedia example:
TEL;TYPE=WORK,VOICE:(111) 555-1212
TEL;TYPE=HOME,VOICE:(404) 555-1212
It would be nice if ppl supported this. It could be achieved like this:
$ ppl phone jdoe --type work 1115551234
$ ppl phone jdoe --type cell 1115556789
The --type
argument would be optional so it shouldn't break compatibility with previous versions.
Let's say I have a contact joe
with multiple emails.
$ ppl show joe
Joe Schmoe <[email protected]>
Email Addresses:
[email protected]
[email protected]
The Mutt query only returns the contact's first email.
$ ppl mutt joe
Searching address book... 12 entries... 1 matching:
[email protected] Joe Schmoe
I need the query to return one entry per email so that I can select which address to use in Mutt. Such as:
$ ppl mutt joe
Searching address book... 12 entries... 2 matching:
[email protected] Joe Schmoe
[email protected] Joe Schmoe
In issue #22 we discussed the issue of ANSI color escape codes when using ppl nick
to source contact IDs for use in autocompletion. It was decided that stripping them with sed was an acceptable short term solution until a --no-color
flag could be added to ppl nick
.
It now seems that there are some awkward little incompatibilities between GNU sed and BSD sed, which is causing a bit of trouble for anybody trying to install autocompletion on an OS X system.
The time has come to add that --no-color
flag, amend the completion code, and fix this properly.
I'm running people on ubuntu 10.04 with ruby 1.9.3p327.
All the commands seem to work properly, except the 'post' command.
> ppl post me "1 Testing Road"
> ppl post me
>
Shouldn't that print back my postal address, like the other commands?
Regarding http://ppladdressbook.org/development/roadmap/ Synchronization UX. I worked with http://rubygems.org/gems/git in the past and it is great. Does a nice job.
Are you thinking of storing your contacts in a git repo? clone, add, commit and push can all be wrapped in some method sync as you called it. Would be a nice feature. What do you have in mind?
PS: When does the narwhal bacon?
I just moved about 300 addresses (created by https://github.com/shushcat/goog2ppl) into ppl
It turned out that
A) some of my addresses where malformed
B) ppl shows me an error message but not in which file
STEPS TO REPRODUCE
-) in any vcard add some malformed line (like lalalala\n
) right below BEGIN:VCARD
-) you'll get the error message ppl: lalalala
Not to helpful.
After fixing these errors I'm getting ppl: incompatible character encodings: ASCII-8BIT and UTF-8
. Again no clue which file to check.
So: please add the file name to parsing errors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.