Skip to content

Commit

Permalink
best effort display name from snakecase
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyworkman committed Nov 12, 2023
1 parent 8b9d7ac commit b7fb718
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion latch_cli/snakemake/config/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,16 @@ def generate_metadata(

is_file = typ in {LatchFile, LatchDir}
param_typ = "SnakemakeFileParameter" if is_file else "SnakemakeParameter"

def _best_effort_display_name(param_name: str):
if param_name[0] == "_":
param_name = param_name[1:]
return " ".join(map(lambda x: x.capitalize(), param_name.split("_")))

param_str = reindent(
f"""\
{repr(identifier_from_str(k))}: {param_typ}(
display_name={repr(k)},
display_name={repr(_best_effort_display_name(k))},
type={type_repr(typ)},
__config____default__),""",
0,
Expand Down

0 comments on commit b7fb718

Please sign in to comment.