99 import asyncclick as click
1010except ImportError :
1111 import click
12+ import click .core
1213from docutils import nodes
1314from docutils .parsers import rst
1415from docutils .parsers .rst import directives
@@ -63,7 +64,7 @@ def _get_usage(ctx: click.Context) -> str:
6364 return formatter .getvalue ().rstrip ('\n ' ) # type: ignore
6465
6566
66- def _get_help_record (ctx : click .Context , opt : click .Option ) -> ty .Tuple [str , str ]:
67+ def _get_help_record (ctx : click .Context , opt : click .core . Option ) -> ty .Tuple [str , str ]:
6768 """Re-implementation of click.Opt.get_help_record.
6869
6970 The variant of 'get_help_record' found in Click makes uses of slashes to
@@ -171,9 +172,9 @@ def _format_usage(ctx: click.Context) -> ty.Generator[str, None, None]:
171172
172173
173174def _format_option (
174- ctx : click .Context , opt : click .Option
175+ ctx : click .Context , opt : click .core . Option
175176) -> ty .Generator [str , None , None ]:
176- """Format the output for a `click.Option`."""
177+ """Format the output for a `click.core. Option`."""
177178 opt_help = _get_help_record (ctx , opt )
178179
179180 yield '.. option:: {}' .format (opt_help [0 ])
@@ -196,10 +197,14 @@ def _format_option(
196197def _format_options (ctx : click .Context ) -> ty .Generator [str , None , None ]:
197198 """Format all `click.Option` for a `click.Command`."""
198199 # the hidden attribute is part of click 7.x only hence use of getattr
200+ print (ctx .command .params )
201+ for param in ctx .command .params :
202+ print (type (param ))
203+ print (isinstance (param , click .Option ))
199204 params = [
200205 param
201206 for param in ctx .command .params
202- if isinstance (param , click .Option ) and not getattr (param , 'hidden' , False )
207+ if isinstance (param , click .core . Option ) and not getattr (param , 'hidden' , False )
203208 ]
204209
205210 for param in params :
@@ -238,7 +243,7 @@ def _format_arguments(ctx: click.Context) -> ty.Generator[str, None, None]:
238243
239244
240245def _format_envvar (
241- param : ty .Union [click .Option , click .Argument ]
246+ param : ty .Union [click .core . Option , click .Argument ]
242247) -> ty .Generator [str , None , None ]:
243248 """Format the envvars of a `click.Option` or `click.Argument`."""
244249 yield '.. envvar:: {}' .format (param .envvar )
0 commit comments