def Run(self, options, args):
        if len(args) == 0:
            self.print_help()
            self.exit()

        store = StoreClient(options.user, options.store)

        cols = ["Name"]
        rows = []

        try:
            ab = self._FindAddressbook(store, args[0])
            if ab is None:
                print "Could not find addressbook named '%s'" % args[0]
                return

            contacts = list(store.List(ab.uid, ["nmap.document"]))

            for contact in contacts:
                jsob = simplejson.loads(contact.props["nmap.document"].strip())

                name = jsob.get("fn")

                rows.append((name,))
        finally:
            store.Quit()

        rows.sort()
        print table.format_table(cols, rows)
    def Run(self, options, args):
        store = StoreClient(options.user, options.store)

        cols = ["Summary", "Start", "End"]
        rows = []

        try:
            cal = self._FindCalendar(store, args[0])
            if cal is None:
                print "Could not find calendar named '%s'" % args[0]
                return

            events = list(store.Events(cal.uid, ["nmap.document",
                                                 "nmap.event.calendars"]))

            for event in events:
                jsob = simplejson.loads(event.props["nmap.document"].strip())
                comp = jsob["components"][0]

                summary = comp.get("summary")
                if summary is not None:
                    summary = summary.get("value")

                start = comp.get("start")
                if start is not None:
                    start = start.get("value")

                end = comp.get("end")
                if end is not None:
                    end = end.get("value")

                rows.append((summary, start, end))
        finally:
            store.Quit()

        rows.sort()
        print table.format_table(cols, rows)