yoda/subcommand/show.py
def show_workspace(self, name):
        """Show specific workspace."""
        if not self.workspace.exists(name):
            raise ValueError("Workspace `%s` doesn't exists." % name)

        color = Color()
        workspaces = self.workspace.list()

        self.logger.info("<== %s workspace ==>" % color.colored(name, "green"))
        self.logger.info("\tPath: %s" % workspaces[name]["path"])
        self.logger.info("\tNumber of repositories: %s"
                         % color.colored(
                             len(workspaces[name]["repositories"]),
                             "yellow"))

        repo_colored = color.colored("Repositories", "blue")
        path_colored = color.colored("Path", "blue")
        trepositories = PrettyTable(
            [repo_colored, path_colored, color.colored("+", "blue")])
        trepositories.align[repo_colored] = "l"
        trepositories.align[path_colored] = "l"

        for repo_name in workspaces[name]["repositories"]:
            fullname = "%s/%s" % (name, repo_name)
            fullpath = find_path(fullname, self.config)[fullname]
            try:
                repo = Repository(fullpath)
                repo_scm = repo.get_scm()
            except RepositoryAdapterNotFound:
                repo_scm = None
            trepositories.add_row(
                [color.colored(repo_name, "cyan"), fullpath, repo_scm])

        self.logger.info(trepositories)
def show_workspace(self, name):
        """Show specific workspace."""
        if not self.workspace.exists(name):
            raise ValueError("Workspace `%s` doesn't exists." % name)

        color = Color()
        workspaces = self.workspace.list()

        self.logger.info("<== %s workspace ==>" % color.colored(name, "green"))
        self.logger.info("\tPath: %s" % workspaces[name]["path"])
        self.logger.info("\tNumber of repositories: %s"
                         % color.colored(
                             len(workspaces[name]["repositories"]),
                             "yellow"))

        repo_colored = color.colored("Repositories", "blue")
        path_colored = color.colored("Path", "blue")
        trepositories = PrettyTable(
            [repo_colored, path_colored, color.colored("+", "blue")])
        trepositories.align[repo_colored] = "l"
        trepositories.align[path_colored] = "l"

        for repo_name in workspaces[name]["repositories"]:
            fullname = "%s/%s" % (name, repo_name)
            fullpath = find_path(fullname, self.config)[fullname]
            try:
                repo = Repository(fullpath)
                repo_scm = repo.get_scm()
            except RepositoryAdapterNotFound:
                repo_scm = None
            trepositories.add_row(
                [color.colored(repo_name, "cyan"), fullpath, repo_scm])

        self.logger.info(trepositories)
def show_workspace ( self , name ) : if not self . workspace . exists ( name ) : raise ValueError ( "Workspace `%s` doesn't exists." % name ) color = Color ( ) workspaces = self . workspace . list ( ) self . logger . info ( "<== %s workspace ==>" % color . colored ( name , "green" ) ) self . logger . info ( "\tPath: %s" % workspaces [ name ] [ "path" ] ) self . logger . info ( "\tNumber of repositories: %s" % color . colored ( len ( workspaces [ name ] [ "repositories" ] ) , "yellow" ) ) repo_colored = color . colored ( "Repositories" , "blue" ) path_colored = color . colored ( "Path" , "blue" ) trepositories = PrettyTable ( [ repo_colored , path_colored , color . colored ( "+" , "blue" ) ] ) trepositories . align [ repo_colored ] = "l" trepositories . align [ path_colored ] = "l" for repo_name in workspaces [ name ] [ "repositories" ] : fullname = "%s/%s" % ( name , repo_name ) fullpath = find_path ( fullname , self . config ) [ fullname ] try : repo = Repository ( fullpath ) repo_scm = repo . get_scm ( ) except RepositoryAdapterNotFound : repo_scm = None trepositories . add_row ( [ color . colored ( repo_name , "cyan" ) , fullpath , repo_scm ] ) self . logger . info ( trepositories )
Show specific workspace.
Show specific workspace .