Friday, 25 October 2013

Access Google Contacts from Terminal...

The Contacts app on the Mac is great, but many users rely on Google Contacts to store and view contact cards for people. If you're not syncing Google Contacts with your Mac or iOS device, then you have to access your contacts from your Google account in a web browser — or not. As we'll show you today, you can also use the Terminal alongside Google Command Line Tools to access your contacts without ever leaving the command line. Continue reading, and we'll show you show to list, create, and delete contacts with your Google account. And as a bonus, we'll also show you how to generate a CSV file containing your contacts as a backup.


Listing Contacts

To list all of your currently stored contacts from your Google account, type the following command:
google contacts list --title ".*."
After pressing enter, you'll see your contacts printed to the screen. If you wish to look up a specific person in your contacts, then type the following command to easily search for that person's contact info:
google contacts list --title "Name"
Replace "Name" in the above command with the name of the person you wish to search for in your Contacts. If the person is found, then their contact information will be printed to the screen.

Adding a Contact

Adding a new contact to your Google account is super-easy. To do it, simply use the following command:
google contacts add "FirstName LastName, email@domain.com"
Replace "FirstName" with the first name of the person you're adding, "LastName" with the last name of the person you're adding, and finally, replace "email@domain.com" with the email address of the person you're adding.

After pressing enter, the contact will be added, but you will not be given a confirmation that it has.

Deleting a Contact

Deleting a contact is just as simple as adding one. To delete one of the contacts in your existing list, use the following command, replacing "FirstName" with the first name of the contact that you wish to delete:
google contacts delete --title "FirstName"
When you press enter, you'll be prompted to reply with a "y" (yes) or a "n" (no) as to whether you wish to remove the contact from your Google account.
this is how you can contact with google directly in terminal itself

0 comments:

Post a Comment