Skip to content

Commit

Permalink
Separate help-texts
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel2392 committed Apr 20, 2024
1 parent 36c0921 commit ddfbaa1
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions wagtail_fedit/management/commands/adapter_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ def handle(self, *args, **options):
" * Absolute arguments (missing an equal sign) are optional and treated as booleans.",
" * Keyword arguments wrapped in square brackets are optional. [key=value]",
" * The value of the adapter is the value of the field.",
"====================",
"",
]

for identifier, adapter_class in adapter_registry.adapters.items():

s.append(
"==========",
)

s.append(
""
)

DISTANCE = " "
s.append(
f"{DISTANCE}{{% {TEMPLATE_TAG_NAME} {identifier} instance.modelfield {adapter_class.usage_string()} %}}",
Expand All @@ -31,13 +38,19 @@ def handle(self, *args, **options):
HELP_DISTANCE = DISTANCE + " "
description = adapter_class.usage_description
if description:
s.append(f"{HELP_DISTANCE}{description}")
s.append(
f"{HELP_DISTANCE}{description}",
)

help_text = adapter_class.usage_help_text()
if help_text:
mid = f"{HELP_DISTANCE} * "
help_text = f"{LB}{mid}".join([f"{k}: {v}" for k, v in help_text.items()])
s.append(f"{mid}{help_text}")
help_text = f"{LB}{mid}".join([
f"{k}: {v}" for k, v in help_text.items()
])
s.append(
f"{mid}{help_text}",
)

s.append("")

Expand Down

0 comments on commit ddfbaa1

Please sign in to comment.