Commit 48d0f32d authored by Sebastien Luttringer's avatar Sebastien Luttringer
Browse files

is list can display repository content with full path

parent 6acae6e7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -246,8 +246,7 @@ def c_list(parser, args):
            repos = fnmatch.filter(repoman.onlines, o)
            if len(repos) > 0:
                for reponame in repos:
                    arrow(reponame)
                    repoman[reponame].show(verbose=args.verbose)
                    repoman[reponame].show(verbose=args.verbose, aspath=args.as_path)
            else:
                img, repo = select_image(o, repoman, args.best)
                img.show(verbose=args.verbose, changelog=args.changelog)
@@ -452,6 +451,8 @@ p_list.add_argument("-b", "--best", action="store_true", default=False,
                    help="in best mode, image is the most recent in all repositories")
p_list.add_argument("-c", "--changelog", action="store_true", default=False,
                    help="display image changelog")
p_list.add_argument("-p", "--as-path", action="store_true", default=False,
                    help="display repoistory content as path")
p_list.add_argument("object", nargs="*",
                    help="object syntax is <path|repository|[repository/]image[:version]>")
p_list.set_defaults(func=c_list, subparser=p_list)
+26 −18
Original line number Diff line number Diff line
@@ -307,13 +307,22 @@ class Repository(object):
        # update last file
        self.update_last()

    def show(self, verbose=False):
    def show(self, verbose=False, aspath=False):
        '''
        List images in repository
        '''
        if aspath:
            images = self.db.ask("SELECT md5, name, version  FROM image ORDER BY name, version").fetchall()
            for (image_md5, image_name, image_version) in images:
                s = "#light##blue#%s#reset#/#light##yellow#%s#reset#:#light##red#%s#reset#" % (
                    self.config.name, image_name, image_version)
                if verbose:
                    s += " [%s]" % image_md5
                out(s)
        else:
            arrow(self.config.name)
            images = self.db.ask("SELECT md5, name, version, date,\
                author, description, size FROM image ORDER BY name, version").fetchall()

            for (image_md5, image_name, image_version, image_date, image_author,
                 image_description, image_size) in images:
                out("#light##yellow#%s #reset#v%s" % (image_name, image_version))
@@ -621,7 +630,6 @@ class RepositoryManager(object):
        Show repository inside manager
        '''
        for repo in self.repos:
            repo.config.name
            s = "#light##blue#%s#reset#"% repo.config.name
            if verbose:
                s += " (%s)" % repo.config.path