How to use the st2client.formatters.table.MultiColumnTable function in st2client

To help you get started, we’ve selected a few st2client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github StackStorm / st2 / st2client / st2client / commands / rule_enforcement.py View on Github external
def run_and_print(self, args, **kwargs):
        instances, count = self.run(args, **kwargs)
        if args.json or args.yaml:
            self.print_output(
                reversed(instances),
                table.MultiColumnTable,
                attributes=args.attr,
                widths=args.width,
                json=args.json,
                yaml=args.yaml,
                attribute_transform_functions=self.attribute_transform_functions,
            )
        else:
            self.print_output(
                instances, table.MultiColumnTable, attributes=args.attr, widths=args.width
            )
            if args.last and count and count > args.last:
                table.SingleRowTable.note_box(self.resource_name, args.last)
github StackStorm / st2 / st2client / st2client / commands / rbac.py View on Github external
def run_and_print(self, args, **kwargs):
        instances = self.run(args, **kwargs)
        self.print_output(
            instances,
            table.MultiColumnTable,
            attributes=args.attr,
            widths=args.width,
            json=args.json,
            yaml=args.yaml,
        )
github StackStorm / st2 / st2client / st2client / commands / webhook.py View on Github external
instance.url = instance.parameters['url']

        instances = sorted(instances, key=lambda k: k.url)

        if args.json or args.yaml:
            self.print_output(
                instances,
                table.MultiColumnTable,
                attributes=args.attr,
                widths=args.width,
                json=args.json,
                yaml=args.yaml,
            )
        else:
            self.print_output(
                instances, table.MultiColumnTable, attributes=args.attr, widths=args.width
            )
github StackStorm / st2 / st2client / st2client / commands / keyvalue.py View on Github external
def run_and_print(self, args, **kwargs):
        instances, count = self.run(args, **kwargs)
        if args.json or args.yaml:
            self.print_output(
                reversed(instances),
                table.MultiColumnTable,
                attributes=args.attr,
                widths=args.width,
                json=args.json,
                yaml=args.yaml,
                attribute_transform_functions=self.attribute_transform_functions,
            )
        else:
            self.print_output(
                instances,
                table.MultiColumnTable,
                attributes=args.attr,
                widths=args.width,
                attribute_transform_functions=self.attribute_transform_functions,
            )

            if args.last and count and count > args.last:
                table.SingleRowTable.note_box(self.resource_name, args.last)
github StackStorm / st2 / st2client / st2client / commands / webhook.py View on Github external
def run_and_print(self, args, **kwargs):
        instances = self.run(args, **kwargs)

        for instance in instances:
            instance.url = instance.parameters['url']

        instances = sorted(instances, key=lambda k: k.url)

        if args.json or args.yaml:
            self.print_output(
                instances,
                table.MultiColumnTable,
                attributes=args.attr,
                widths=args.width,
                json=args.json,
                yaml=args.yaml,
            )
        else:
            self.print_output(
                instances, table.MultiColumnTable, attributes=args.attr, widths=args.width
            )
github StackStorm / st2 / st2client / st2client / commands / triggerinstance.py View on Github external
def run_and_print(self, args, **kwargs):
        instances, count = self.run(args, **kwargs)
        if args.json or args.yaml:
            self.print_output(
                reversed(instances),
                table.MultiColumnTable,
                attributes=args.attr,
                widths=args.width,
                json=args.json,
                yaml=args.yaml,
                attribute_transform_functions=self.attribute_transform_functions,
            )
        else:
            self.print_output(
                reversed(instances),
                table.MultiColumnTable,
                attributes=args.attr,
                widths=args.width,
                attribute_transform_functions=self.attribute_transform_functions,
            )
            if args.last and count and count > args.last:
                table.SingleRowTable.note_box(self.resource_name, args.last)
github StackStorm / st2 / st2client / st2client / commands / action.py View on Github external
if task_result:
                instance.result_task = tasks[-1].get('name', 'unknown')
                options['attributes'].insert(status_index + 1, 'result_task')
                options['attributes'].insert(status_index + 2, 'result')
                instance.result = task_result
        # Otherwise include the result of the workflow execution.
        else:
            if 'result' not in options['attributes']:
                options['attributes'].append('result')

        # print root task
        self.print_output(instance, formatter, **options)

        # print child tasks
        if child_instances:
            self.print_output(child_instances, table.MultiColumnTable,
                              attributes=['id', 'status', 'task', 'action', 'start_timestamp'],
                              widths=args.width, json=args.json,
                              yaml=args.yaml,
                              attribute_transform_functions=self.attribute_transform_functions)
github StackStorm / st2 / st2client / st2client / commands / resource.py View on Github external
def run_and_print(self, args, **kwargs):
        instances = self.run(args, **kwargs)
        self.print_output(
            instances,
            table.MultiColumnTable,
            attributes=args.attr,
            widths=args.width,
            json=args.json,
            yaml=args.yaml,
        )
github StackStorm / st2 / st2client / st2client / commands / inquiry.py View on Github external
def run_and_print(self, args, **kwargs):
        instances, count = self.run(args, **kwargs)

        self.print_output(
            reversed(instances),
            table.MultiColumnTable,
            attributes=args.attr,
            widths=args.width,
            json=args.json,
            yaml=args.yaml,
        )
        if args.last and count and count > args.last:
            table.SingleRowTable.note_box(self.resource_name, args.last)
github StackStorm / st2 / st2client / st2client / commands / rule.py View on Github external
def run_and_print(self, args, **kwargs):
        instances, count = self.run(args, **kwargs)
        if args.json or args.yaml:
            self.print_output(
                instances,
                table.MultiColumnTable,
                attributes=args.attr,
                widths=args.width,
                json=args.json,
                yaml=args.yaml,
            )
        else:
            self.print_output(
                instances, table.MultiColumnTable, attributes=args.attr, widths=args.width
            )

            if args.last and count and count > args.last:
                table.SingleRowTable.note_box(self.resource_name, args.last)