How to use the cleo.outputs.Output 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 / outputs / test_output.py View on Github external
def test_init(self):
        output = MyOutput(Output.VERBOSITY_QUIET, True)
        self.assertEqual(Output.VERBOSITY_QUIET, output.get_verbosity())
        self.assertTrue(output.is_decorated())
github sdispater / cleo / tests / test_application.py View on Github external
Application.render_exception() displays formatted exception.
        """
        application = Application()
        application.set_auto_exit(False)

        os.environ['COLUMNS'] = '120'
        tester = ApplicationTester(application)

        tester.run([('command', 'foo')], {'decorated': False})
        self.assertEqual(
            self.open_fixture('application_renderexception1.txt'),
            tester.get_display()
        )

        tester.run([('command', 'foo')],
                   {'decorated': False, 'verbosity': Output.VERBOSITY_VERBOSE})
        self.assertRegex(
            tester.get_display(),
            'Exception trace'
        )

        tester.run([('command', 'list'), ('--foo', True)], {'decorated': False})
        self.assertEqual(
            self.open_fixture('application_renderexception2.txt'),
            tester.get_display()
        )

        application.add(Foo3Command())
        tester = ApplicationTester(application)
        tester.run([('command', 'foo3:bar')], {'decorated': False})
        self.assertEqual(
            self.open_fixture('application_renderexception3.txt'),
github sdispater / cleo / tests / outputs / test_stream_output.py View on Github external
def test_init(self):
        output = StreamOutput(self.stream, Output.VERBOSITY_QUIET, True)
        self.assertEqual(Output.VERBOSITY_QUIET, output.get_verbosity())
        self.assertTrue(output.is_decorated())
github sdispater / cleo / tests / outputs / test_output.py View on Github external
    def __init__(self, verbosity=Output.VERBOSITY_NORMAL, decorated=None, formatter=None):
        super(MyOutput, self).__init__(verbosity, decorated, formatter)

        self.output = ''
github sdispater / cleo / cleo / helpers / progress_bar.py View on Github external
def _determine_best_format(self):
        verbosity = self._output.get_verbosity()

        if verbosity == Output.VERBOSITY_VERBOSE:
            if self._max:
                return 'verbose'

            return 'verbose_nomax'
        elif verbosity == Output.VERBOSITY_VERY_VERBOSE:
            if self._max:
                return 'very_verbose'

            return 'very_verbose_nomax'
        elif verbosity == Output.VERBOSITY_DEBUG:
            if self._max:
                return 'debug'

            return 'debug_nomax'

        if self._max:
github sdispater / cleo / cleo / helpers / progress_indicator.py View on Github external
def _determine_best_format(self):
        verbosity = self._output.get_verbosity()
        decorated = self._output.is_decorated()

        if verbosity == Output.VERBOSITY_VERBOSE:
            if decorated:
                return 'verbose'

            return 'verbose_no_ansi'
        elif verbosity in [Output.VERBOSITY_VERY_VERBOSE, Output.VERBOSITY_DEBUG]:
            if decorated:
                return 'very_verbose'

            return 'very_verbose_no_ansi'

        if decorated:
            return 'normal'

        return 'normal_no_ansi'
github sdispater / cleo / cleo / helpers / progress_indicator.py View on Github external
def _display(self):
        if self._output.get_verbosity() == Output.VERBOSITY_QUIET:
            return

        self._overwrite(re.sub('(?i)%([a-z\-_]+)(?:\:([^%]+))?%', self._overwrite_callback, self.format))
github sdispater / cleo / cleo / styles / output_style.py View on Github external
    def write(self, messages, newline=False, type=Output.OUTPUT_NORMAL):
        self._do_write(messages, newline, False, type)
github sdispater / cleo / cleo / helpers / progress_bar.py View on Github external
def display(self):
        """
        Ouput the current progress string.
        """
        if self._output.get_verbosity() == Output.VERBOSITY_QUIET:
            return

        if self._format is None:
            self._set_real_format(self._internal_format or self._determine_best_format())

        self._overwrite(re.sub('(?i)%([a-z\-_]+)(?:\:([^%]+))?%', self._overwrite_callback, self._format))