def TablePrinter(show_versions=False): """Gets a console_io.TablePrinter for printing ComponentSnapshotDiffs. Args: show_versions: bool, True to display version information. Defaults to False. Returns: console_io.TablePrinter: The table printer to use to print this object type. """ if show_versions: headers = ('Status', 'Name', 'ID', 'Installed', 'Latest', 'Size') justification = (console_io.TablePrinter.JUSTIFY_LEFT, console_io.TablePrinter.JUSTIFY_LEFT, console_io.TablePrinter.JUSTIFY_LEFT, console_io.TablePrinter.JUSTIFY_RIGHT, console_io.TablePrinter.JUSTIFY_RIGHT, console_io.TablePrinter.JUSTIFY_RIGHT) else: headers = ('Status', 'Name', 'ID', 'Size') justification = (console_io.TablePrinter.JUSTIFY_LEFT, console_io.TablePrinter.JUSTIFY_LEFT, console_io.TablePrinter.JUSTIFY_LEFT, console_io.TablePrinter.JUSTIFY_RIGHT) return console_io.TablePrinter(headers, justification=justification)
def TablePrinter(): """Gets a console_io.TablePrinter for printing a Component.""" headers = (None, None, None) justification = (console_io.TablePrinter.JUSTIFY_LEFT, console_io.TablePrinter.JUSTIFY_RIGHT, console_io.TablePrinter.JUSTIFY_RIGHT) return console_io.TablePrinter(headers, justification=justification)
def Display(self, args, result): """This method is called to print the result of the Run() method. Args: args: The arguments that command was run with. result: The value returned from the Run() method. """ tbl = io.TablePrinter(['SUBSCRIPTION', 'TYPE', 'ACK DEADLINE'], justification=tuple( [io.TablePrinter.JUSTIFY_LEFT] * 3)) tbl.Print([TableValues(subscription) for subscription in result])
def Display(self, args, result): """This method is called to print the result of the Run() method. Args: args: The arguments that command was run with. result: The value returned from the Run() method. """ tbl = io.TablePrinter( ['Name', 'ID', 'Zone', 'Nodes'], justification=tuple([io.TablePrinter.JUSTIFY_LEFT] * 3 + [io.TablePrinter.JUSTIFY_RIGHT])) values = [TableValues(cluster) for cluster in result.clusters] tbl.Print(values) if not values: log.err.Print('0 clusters')
def Display(self, args, result): """This method is called to print the result of the Run() method. Args: args: The arguments that command was run with. result: The value returned from the Run() method. """ tbl_header = ['DATA', 'MESSAGE_ID', 'ATTRIBUTES'] if not args.auto_ack: tbl_header.append('ACK_ID') tbl = io.TablePrinter( tbl_header, justification=tuple( [io.TablePrinter.JUSTIFY_LEFT] * len(tbl_header))) tbl.Print( [TableValues(msg, args.auto_ack) for msg in result.receivedMessages])