Exemplo n.º 1
0
  def Display(self, unused_args, result):
    if result.accounts:
      lp = console_io.ListPrinter('Credentialed accounts:')
      lp.Print([account +
                (' (active)' if account == result.active_account else '')
                for account in result.accounts])
      log.err.Print(textwrap.dedent("""
          To set the active account, run:
            $ gcloud config set account ``ACCOUNT''
          """))
    else:
      log.err.Print(textwrap.dedent("""\
          No credentialed accounts.

          To login, run:
            $ gcloud auth login ``ACCOUNT''
          """))
Exemplo n.º 2
0
def ConstructList(title, items):
    """Returns a string displaying the items and a title."""
    buf = cStringIO.StringIO()
    printer = console_io.ListPrinter(title)
    printer.Print(sorted(set(items)), output_stream=buf)
    return buf.getvalue()
Exemplo n.º 3
0
def ConstructList(title, items):
    buf = cStringIO.StringIO()
    printer = console_io.ListPrinter(title)
    printer.Print(items, output_stream=buf)
    return buf.getvalue()