当前位置: 首页>>代码示例>>Python>>正文


Python Printer.dict_table方法代码示例

本文整理汇总了Python中cloudmesh_client.common.Printer.Printer.dict_table方法的典型用法代码示例。如果您正苦于以下问题:Python Printer.dict_table方法的具体用法?Python Printer.dict_table怎么用?Python Printer.dict_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cloudmesh_client.common.Printer.Printer的用法示例。


在下文中一共展示了Printer.dict_table方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_launcher

# 需要导入模块: from cloudmesh_client.common.Printer import Printer [as 别名]
# 或者: from cloudmesh_client.common.Printer.Printer import dict_table [as 别名]
    def do_launcher(self, args, arguments):
        """
        ::

          Usage:
              launcher repo add NAME URL
              launcher repo delete NAME
              launcher repo list
              launcher repo
              launcher list [NAMES] [--cloud=CLOUD] [--format=FORMAT] [--source=db|dir]
              launcher add NAME SOURCE
              launcher delete [NAMES] [--cloud=CLOUD]
              launcher clear
              launcher run [NAME]
              launcher resume [NAME]
              launcher suspend [NAME]
              launcher refresh
              launcher log [NAME]
              launcher status [NAME]


          Arguments:

            KEY    the name of the launcher

          Options:

             --cloud=CLOUD    the name of the cloud
             --format=FORMAT  the output format [launcher: table]
             --all            lists all the launcher values

        Description:

        Launcher is a command line tool to test the portal launch
        functionalities through command line.

        The current launcher values can by listed with --all option:(
        if you have a launcher cloud specified. You can also add a
        cloud parameter to apply the command to a specific cloud)

               launcher list

            A launcher can be deleted with

                launcher delete KEY


        Examples:
            launcher list --all
            launcher list --cloud=general
            launcher delete <KEY>
        """

        print ("AAA")
        arg = dotdict(arguments)
        if arg.NAMES is not None:
            arg.names = Parameter.expand(arg.NAMES)
        else:
            arg.names = None
        if arg.name == ["all"]:
            arg.names = None
        arg.cloud = arguments["--cloud"] or Default.cloud
        arg.output = arguments['--format'] or 'table'
        arg.source = arguments['--source'] or 'db'
        print ("BBB")

        pprint(arg)

        # arg.cloud = arguments["--cloud"] or Default.cloud
        # c = arg.list
        # print ("Hallo {cloud} is list={list}".format(**arg))
        # launcher = Launcher(kind=None)

        if arg.cloud is None:
            Console.error("Default arg.cloud not set")
            return

        result = ""

        if arguments["repo"] and arguments["list"]:
            print("repo list")
            launchers = ConfigDict(filename="cm_launcher.yaml")["cloudmesh"]["repo"]
            print("repo add")
            d = {}
            for name in launchers:
                location = launchers[name]["location"]
                d[name] = {"name": name,
                           "location": location}
            print (Printer.dict_table(d))
            return ""

        elif arguments["repo"] and arguments["add"]:
            launchers = ConfigDict(filename="cm_launcher.yaml")
            print("repo add")
            print(launchers)
            return ""

        elif arguments["repo"] and arguments["delete"]:
            print("repo delete")
            return ""
#.........这里部分代码省略.........
开发者ID:cloudmesh,项目名称:client,代码行数:103,代码来源:LauncherCommand.py


注:本文中的cloudmesh_client.common.Printer.Printer.dict_table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。