Pass output through pager.

    See :manpage:`less(1)`, if you wish to configure the default pager.  For
    example, you may wish to check ``FRSX`` options.

    Args:
        __text: Text to page
        pager: Pager to use
420773
def pager(__text: str, *, pager: Optional[str] = 'less'):
    
    if pager:
        run([pager, ], input=__text.encode())
    else:
        print(__text)
246113
def page(self, attr=None, fill=u' '):
        '''
        if attr is None:
            attr = self.attr
        if len(fill) != 1:
            raise ValueError
        info = CONSOLE_SCREEN_BUFFER_INFO()
        self.GetConsoleScreenBufferInfo(self.hout, byref(info))
        if info.dwCursorPosition.X != 0 or info.dwCursorPosition.Y != 0:
            self.SetConsoleCursorPosition(self.hout, self.fixcoord(0, 0))

        w = info.dwSize.X
        n = DWORD(0)
        for y in range(info.dwSize.Y):
            self.FillConsoleOutputAttribute(self.hout, attr, 
                                            w, self.fixcoord(0, y), byref(n))
            self.FillConsoleOutputCharacterW(self.hout, ord(fill[0]), 
                                             w, self.fixcoord(0, y), byref(n))

        self.attr = attr
232388
def output(self, full_text, short_text):
        
        full_text = full_text.replace('\n', '')
        short_text = short_text.replace('\n', '')
        self.output_options.update({'full_text': full_text, 'short_text': short_text})
        self.output_options = {k: v for k, v in self.output_options.items() if v}
        return self.output_options
65158
def get_page(self, page_number):
        

        if page_number:
            kwargs = dict(self._list_kwargs)
            kwargs['limit'] = self.limit
            kwargs['page'] = page_number

            return self._controller.list(**kwargs)
23069
def print_there(x, y, text):
    "
    sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (x, y, text))
    sys.stdout.flush()
264699
def send(self,text):
	""""""
	#print text
	self.s.write(text)
	time.sleep(0.001*len(text))
496665
def with_text(self, text, markdown=None):
        '''
        '''
        self._text = text
        self._markdown = markdown or False

        return self
213363
def _prompt_wrapper(message, default=None, validator=None):
    

    class MockDocument:

        def __init__(self, text):
            self.text = text

    if HAS_INPUT:
        ret = prompt(message, default=default, validator=validator)
    else:
        ret = sys.stdin.readline().strip()
        print(message, ret)
        if validator:
            validator.validate(MockDocument(ret))
    if "q" in ret:
        if not HAS_OUTPUT:
            print("User exit")
        sys.exit("User exit")
    return ret
779881
def printer(text, color=None, **kwargs):
    
    if nocolor:
        # import sys
        # sys.stdout.write(text + "" if ("end" in kwargs and kwargs["end"] == "") else '\n')
        # sys.stdout.flush()
        print(text, **kwargs)
    else:
        if color is None:
            cprint(text, **kwargs)
        else:
            cprint(text, color, **kwargs)
482102
def print_help(self, *args, **kwargs):
        
        if self._command is not None and self._command.session.allow_pager:
            desc = 'Help\: %s' % '-'.join(self.prog.split())
            pager_kwargs = self._command.get_pager_spec()
            with paging.pager_redirect(desc, **pager_kwargs):
                return super().print_help(*args, **kwargs)
        else:
                return super().print_help(*args, **kwargs)
394164
def write(self, text):
        

        if self.disabled:
            self.write_with_encoding(self.encoding, text)
            return

        # See how far we can go into the text with the current encoding
        to_write, text = split_writable_text(self.encoder, text, self.encoding)
        if to_write:
            self.write_with_encoding(self.encoding, to_write)

        while text:
            # See if any of the code pages that the printer profile
            # supports can encode this character.
            encoding = self.encoder.find_suitable_encoding(text[0])
            if not encoding:
                self._handle_character_failed(text[0])
                text = text[1:]
                continue

            # Write as much text as possible with the encoding found.
            to_write, text = split_writable_text(self.encoder, text, encoding)
            if to_write:
                self.write_with_encoding(encoding, to_write)
105931
def process_Text( self, text, **kwargs ):
        ''' 
        ''' 
        mrf_lines = convert_Text_to_mrf( text )
        return self.process_mrf_lines( mrf_lines, **kwargs )
360212
def page(content, pagecallback=prompt):
    
    width = getwidth()
    height = getheight()
    pagenum = 1

    try:
        try:
            line = content.next().rstrip("\r\n")
        except AttributeError:
            # Python 3 compatibility
            line = content.__next__().rstrip("\r\n")
    except StopIteration:
        pagecallback(pagenum)
        return

    while True:     # page cycle
        linesleft = height-1 # leave the last line for the prompt callback
        while linesleft:
            linelist = [line[i:i+width] for i in range(0, len(line), width)]
            if not linelist:
                linelist = ['']
            lines2print = min(len(linelist), linesleft)
            for i in range(lines2print):
                if WINDOWS and len(line) == width:
                    # avoid extra blank line by skipping linefeed print
                    echo(linelist[i])
                else:
                    print((linelist[i]))
            linesleft -= lines2print
            linelist = linelist[lines2print:]

            if linelist: # prepare symbols left on the line for the next iteration
                line = ''.join(linelist)
                continue
            else:
                try:
                    try:
                        line = content.next().rstrip("\r\n")
                    except AttributeError:
                        # Python 3 compatibility
                        line = content.__next__().rstrip("\r\n")
                except StopIteration:
                    pagecallback(pagenum)
                    return
        if pagecallback(pagenum) == False:
            return
        pagenum += 1
1373151
def run(self, text):
        
        for pp in self.pre_processors:
            text = pp.run(text)
        return text
340029
def send_kwargs(self) -> dict:
        

        display_page = self.display_page
        page_num = f'\nPage {display_page + 1}/{self.page_count}'
        content = self.pages[display_page] + page_num
        return {'content': content}
1350293
def show_output(self, txt, device='Console'):
        
        if device == 'Console':
            print(txt)
        elif device == 'File':
            raise ('show_output to File not implemented')
        elif device == 'Function_Return':  # hacky, to run test_AI_CLI.py
            return txt
625895
def _PromptUserForInput(self, input_text):
    
    self._output_writer.Write('{0:s}: '.format(input_text))
    return self._input_reader.Read()