Skip to content

Commit

Permalink
fix help [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
iammosespaulr committed Nov 21, 2024
1 parent 3b383f8 commit 72ba6ab
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions marker/config/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,25 @@ def find_subclasses(base_class):


class CustomClickPrinter(click.Command):
def get_help(self, ctx):
additional_help = (
"\n\nTip: Use 'config --help' to display all the attributes of the Builders, Processors, and Converters in Marker."
)
help_text = super().get_help(ctx)
help_text = help_text + additional_help
click.echo(help_text)

def parse_args(self, ctx, args):
# If '-l' is in the arguments, handle it and exit
if '-l' in args:
if 'config' in args and '--help' in args:
click.echo("Here is a list of all the Builders, Processors, and Converters in Marker along with their attributes:")
base_classes = [BaseBuilder, BaseProcessor, BaseConverter]
for base in base_classes:
click.echo(f"{base.__name__.removeprefix('Base')}s:\n")

subclasses = find_subclasses(base)
for class_name, class_type in subclasses.items():
doc = class_type.__doc__
if doc and "Attributes:" in doc:
click.echo(f"{class_name}: {doc}")
click.echo(f" {class_name}: {doc}")
ctx.exit()
super().parse_args(ctx, args)

0 comments on commit 72ba6ab

Please sign in to comment.