@login
    @command(capsule=int)
    def do_archives(self, capsule=None):
        """
        Usage: archives [<capsule>]
        """
        try:
            if capsule is not None:
                capsules = self.session.capsule_ids()
                if capsule not in capsules:
                    print "No such capsule"
                    return
                capsule = capsules[capsule]
            archives = self.session.archives()
            if capsule is not None:
                archives = [a for a in archives
                            if a['capsule'] == capsule['resource_uri']]
            if len(archives) > 0:
                capsules = dict(
                    [(c['resource_uri'], c['title'])
                     for c in self.session.capsules()])
                ui.print_archives_header()
                for n, archive in enumerate(archives):
                    ui.print_archives_line(archive={
                        'num': n+1,
                        'size': format_size(int(archive['size'])),
                        'title': archive['title'],
                        'cert': archive['key'],
                        'created': archive['created'],
                        'status': "COMPLETE",
                        'capsule': capsules.get(archive['capsule'], '')
                    })
            else:
                print "No available archives."
        except Exception as e:
            print "error: " + str(e)
dataset/ETHPy150Open longaccess/longaccess-client/lacli/command.py/LaCapsuleCommand.do_archives/original