How to use the st2client.formatters.table 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 / trigger.py View on Github external
def run_and_print(self, args, **kwargs):
        if args.help:
            self.parser.print_help()
            return
        instances = self.run(args, **kwargs)
        self.print_output(instances, table.MultiColumnTable, json=args.json, yaml=args.yaml)
github StackStorm / st2 / st2client / st2client / commands / auth.py View on Github external
def run_and_print(self, args, **kwargs):
        instances = self.run(args, **kwargs)
        attr = self.detail_display_attributes if args.detail else args.attr
        self.print_output(instances, table.MultiColumnTable,
                          attributes=attr, widths=args.width,
                          json=args.json, yaml=args.yaml)
github StackStorm / st2 / st2client / st2client / commands / action.py View on Github external
show_tasks = getattr(args, 'show_tasks', False)
        raw = getattr(args, 'raw', False)
        detail = getattr(args, 'detail', False)
        key = getattr(args, 'key', None)
        attr = getattr(args, 'attr', [])

        if show_tasks and not is_workflow_action:
            raise ValueError('--show-tasks option can only be used with workflow actions')

        if not raw and not detail and (show_tasks or is_workflow_action):
            self._run_and_print_child_task_list(execution=execution, args=args, **kwargs)
        else:
            instance = execution

            if detail:
                formatter = table.PropertyValueTable
            else:
                formatter = execution_formatter.ExecutionResult

            if detail:
                options = {'attributes': copy.copy(self.display_attributes)}
            elif key:
                options = {'attributes': ['result.%s' % (key)], 'key': key}
            else:
                options = {'attributes': attr}

            options['json'] = args.json
            options['yaml'] = args.yaml
            options['with_schema'] = args.with_schema
            options['attribute_transform_functions'] = self.attribute_transform_functions
            self.print_output(instance, formatter, **options)
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: