# Path: crmsh/utils.py
# def page_string(s):
#     'Page string rendered for TERM.'
#     if not s:
#         return
#     constants.need_reset = True
#     w, h = get_winsize()
#     if not need_pager(s, w, h):
#         print(term_render(s))
#     elif not config.core.pager or not can_ask() or options.batch:
#         print(term_render(s))
#     else:
#         pipe_string(get_pager_cmd(), term_render(s).encode('utf-8'))
#     constants.need_reset = False
# 
# def get_stdout_stderr(cmd, input_s=None, shell=True, raw=False, no_reg=False):
#     '''
#     Run a cmd, return (rc, stdout, stderr)
#     '''
#     if options.regression_tests and not no_reg:
#         print(".EXT", cmd)
#     proc = subprocess.Popen(cmd,
#                             shell=shell,
#                             stdin=input_s and subprocess.PIPE or None,
#                             stdout=subprocess.PIPE,
#                             stderr=subprocess.PIPE)
#     stdout_data, stderr_data = proc.communicate(input_s)
#     if raw:
#         return proc.returncode, stdout_data, stderr_data
#     return proc.returncode, to_ascii(stdout_data).strip(), to_ascii(stderr_data).strip()
# 
# Path: crmsh/ordereddict.py
# class OrderedDict(dict, DictMixin):
#     def __init__(self, *args, **kwds):
#     def clear(self):
#     def __setitem__(self, key, value):
#     def __delitem__(self, key):
#     def __iter__(self):
#     def __reversed__(self):
#     def popitem(self, last=True):
#     def __reduce__(self):
#     def keys(self):
#     def __repr__(self):
#     def copy(self):
#     def fromkeys(cls, iterable, value=None):
#     def __eq__(self, other):
#     def __ne__(self, other):


import os
import re
from .utils import page_string, get_stdout_stderr
from . import config
from . import clidisplay
from .ordereddict import odict
from . import log
    from .command import fuzzy_get
    from .command import fuzzy_get
    from .command import fuzzy_get
    from .command import fuzzy_get
    from .command import fuzzy_get
        from .ui_root import Root
            if not long_help.startswith('\n'):
                long_help = '\n' + long_help

        prefix = ''
        if self.is_alias():
            prefix = helpfilter("(Redirected from `%s` to `%s`)\n" % self.alias_for)

        page_string(short_help + '\n' + prefix + long_help)

    def set_long_help(self, long_help):
        self.long = long_help

    def __str__(self):
        if self.long:
            return self.short + '\n' + self.long
        return self.short

    def __repr__(self):
        return str(self)


HELP_FILE = os.path.join(config.path.sharedir, 'crm.8.adoc')

_DEFAULT = HelpEntry('No help available', long_help='', alias_for=None, generated=True)
_REFERENCE_RE = re.compile(r'<<[^,]+,(.+)>>')

# loaded on demand
# _LOADED is set to True when an attempt
# has been made (so it won't be tried again)
_LOADED = False

# Path: crmsh/utils.py
# def page_string(s):
#     'Page string rendered for TERM.'
#     if not s:
#         return
#     constants.need_reset = True
#     w, h = get_winsize()
#     if not need_pager(s, w, h):
#         print(term_render(s))
#     elif not config.core.pager or not can_ask() or options.batch:
#         print(term_render(s))
#     else:
#         pipe_string(get_pager_cmd(), term_render(s).encode('utf-8'))
#     constants.need_reset = False
# 
# def get_stdout_stderr(cmd, input_s=None, shell=True, raw=False, no_reg=False):
#     '''
#     Run a cmd, return (rc, stdout, stderr)
#     '''
#     if options.regression_tests and not no_reg:
#         print(".EXT", cmd)
#     proc = subprocess.Popen(cmd,
#                             shell=shell,
#                             stdin=input_s and subprocess.PIPE or None,
#                             stdout=subprocess.PIPE,
#                             stderr=subprocess.PIPE)
#     stdout_data, stderr_data = proc.communicate(input_s)
#     if raw:
#         return proc.returncode, stdout_data, stderr_data
#     return proc.returncode, to_ascii(stdout_data).strip(), to_ascii(stderr_data).strip()
# 
# Path: crmsh/ordereddict.py
# class OrderedDict(dict, DictMixin):
#     def __init__(self, *args, **kwds):
#     def clear(self):
#     def __setitem__(self, key, value):
#     def __delitem__(self, key):
#     def __iter__(self):
#     def __reversed__(self):
#     def popitem(self, last=True):
#     def __reduce__(self):
#     def keys(self):
#     def __repr__(self):
#     def copy(self):
#     def fromkeys(cls, iterable, value=None):
#     def __eq__(self, other):
#     def __ne__(self, other):


# Path: crmsh/help.py
import os
import re
from .utils import page_string, get_stdout_stderr
from . import config
from . import clidisplay
from .ordereddict import odict
from . import log
    from .command import fuzzy_get
    from .command import fuzzy_get
    from .command import fuzzy_get
    from .command import fuzzy_get
    from .command import fuzzy_get
        from .ui_root import Root

            if not long_help.startswith('\n'):
                long_help = '\n' + long_help

        prefix = ''
        if self.is_alias():
            prefix = helpfilter("(Redirected from `%s` to `%s`)\n" % self.alias_for)

        page_string(short_help + '\n' + prefix + long_help)

    def set_long_help(self, long_help):
        self.long = long_help

    def __str__(self):
        if self.long:
            return self.short + '\n' + self.long
        return self.short

    def __repr__(self):
        return str(self)


HELP_FILE = os.path.join(config.path.sharedir, 'crm.8.adoc')

_DEFAULT = HelpEntry('No help available', long_help='', alias_for=None, generated=True)
_REFERENCE_RE = re.compile(r'<<[^,]+,(.+)>>')

# loaded on demand
# _LOADED is set to True when an attempt
# has been made (so it won't be tried again)
_LOADED = False

_TOPICS = odict()