2020import asyncclick as click
2121
2222from dipdup import __version__
23+ from dipdup .install import EPILOG
24+ from dipdup .install import WELCOME_ASCII
2325from dipdup .performance import metrics
2426from dipdup .report import REPORTS_PATH
2527from dipdup .report import ReportHeader
2628from dipdup .report import save_report
2729from dipdup .sys import set_up_process
2830
31+ _click_wrap_text = click .formatting .wrap_text
32+
33+
34+ def _wrap_text (text : str , * a : Any , ** kw : Any ) -> str :
35+ # NOTE: WELCOME_ASCII and EPILOG
36+ if text .startswith ((' ' )):
37+ return text
38+ if text .startswith (('\0 \n ' )):
39+ return text [2 :]
40+ return _click_wrap_text (text , * a , ** kw )
41+
42+
43+ click .formatting .wrap_text = _wrap_text
44+
2945ROOT_CONFIG = 'dipdup.yaml'
3046CONFIG_RE = r'dipdup.*\.ya?ml'
3147
@@ -130,7 +146,11 @@ async def _check_version() -> None:
130146 _logger .info ('Set `skip_version_check` flag in config to hide this message.' )
131147
132148
133- @click .group (context_settings = {'max_content_width' : 120 })
149+ @click .group (
150+ context_settings = {'max_content_width' : 120 },
151+ help = WELCOME_ASCII ,
152+ epilog = EPILOG ,
153+ )
134154@click .version_option (__version__ )
135155@click .option (
136156 '--config' ,
@@ -153,12 +173,6 @@ async def _check_version() -> None:
153173@click .pass_context
154174@_cli_wrapper
155175async def cli (ctx : click .Context , config : list [str ], env_file : list [str ]) -> None :
156- """Manage and run DipDup indexers.
157-
158- Documentation: https://docs.dipdup.io
159-
160- Issues: https://github.com/dipdup-io/dipdup/issues
161- """
162176 # NOTE: Workaround for help pages. First argument check is for the test runner.
163177 args = sys .argv [1 :] if sys .argv else ['--help' ]
164178 if '--help' in args or args in (['config' ], ['hasura' ], ['schema' ]) or args [0 ] in ('self' , 'report' ):
@@ -631,6 +645,7 @@ async def self_update(
631645@click .pass_context
632646@_cli_wrapper
633647async def report (ctx : click .Context ) -> None :
648+ """List and manage reports."""
634649 if ctx .invoked_subcommand :
635650 return
636651
@@ -643,7 +658,7 @@ async def report(ctx: click.Context) -> None:
643658 from ruamel .yaml import YAML
644659
645660 event = YAML (typ = 'base' ).load (path )
646- row = [event .get (key , 'none' ) for key in header ]
661+ row = [event .get (key , 'none' )[: 80 ] for key in header ]
647662 rows .append (row )
648663
649664 rows .sort (key = lambda row : str (row [3 ]))
0 commit comments