How to use the cleo.formatters.Formatter function in cleo

To help you get started, we’ve selected a few cleo 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 sdispater / cleo / tests / formatters / test_output_formatter.py View on Github external
def test_lg_char_escaping(self):
        formatter = Formatter(True)

        self.assertEqual('foosome info',
            formatter.format('\\some info\\')
        )
        self.assertEqual(
            '\\some info\\',
            Formatter.escape('some info')
        )
github sdispater / cleo / tests / formatters / test_output_formatter.py View on Github external
def test_style_matching_non_greedy(self):
        formatter = Formatter(True)

        self.assertEqual(
            '(\033[32m>=2.0,<2.3\033[0m)',
            formatter.format('(>=2.0,<2.3)')
        )
github sdispater / cleo / tests / formatters / test_output_formatter.py View on Github external
def test_style_escaping(self):
        formatter = Formatter(True)

        self.assertEqual(
            '(\033[32mz>=2.0,%s)' % formatter.escape('z>=2.0,
github sdispater / cleo / tests / formatters / test_output_formatter.py View on Github external
def test_adjacent_style(self):
        formatter = Formatter(True)

        self.assertEqual(
            '\033[37;41msome error\033[0m\033[32msome info\033[0m',
            formatter.format('some errorsome info')
        )
github sdispater / cleo / tests / formatters / test_output_formatter.py View on Github external
def test_content_with_line_breaks(self):
        formatter = Formatter(True)

        for expected, message in self.provide_content_with_line_breaks():
            self.assertEqual(expected, formatter.format(message))
github sdispater / cleo / tests / formatters / test_output_formatter.py View on Github external
def test_deep_nested_style(self):
        formatter = Formatter(True)

        self.assertEqual(
            '\033[37;41merror\033[0m\033[32minfo\033[0m\033[33mcomment\033[0m\033[37;41merror\033[0m',
            formatter.format('errorinfocommenterror')
        )
github sdispater / cleo / cleo / outputs / output.py View on Github external
def __init__(self, verbosity=VERBOSITY_NORMAL, decorated=False, formatter=None):
        self.verbosity = self.VERBOSITY_NORMAL if verbosity is None else verbosity
        self.formatter = formatter or Formatter(decorated)
github ahal / jetty / jetty / cli / application.py View on Github external
def __init__(self, path=None):
        BaseApplication.__init__(self, "Jetty", __version__)
        self._path = path
        self._poetry = None
        self._skip_io_configuration = False
        self._formatter = Formatter(True)
        self._formatter.add_style("error", "red", options=["bold"])