Skip to content

Commit

Permalink
Bubble up conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
evolutics committed Apr 6, 2024
1 parent 0db6022 commit df38dad
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions travelkit/readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ def _menu_entry(identifier, cleaner):

def _details(cleaner):
return "\n\n".join(
_file_pattern_entries(cleaner.file_patterns) + [_command_entry(cleaner.command)]
([_file_pattern_entry(cleaner.file_patterns)] if cleaner.file_patterns else [])
+ [_command_entry(cleaner.command)]
)


def _file_pattern_entries(file_patterns):
if file_patterns:
humanized_patterns = ", ".join(f"`{pattern}`" for pattern in file_patterns)
return [f"Only applied to files matching patterns: {humanized_patterns}"]
return []
def _file_pattern_entry(file_patterns):
humanized_patterns = ", ".join(f"`{pattern}`" for pattern in file_patterns)
return f"Only applied to files matching patterns: {humanized_patterns}"


def _command_entry(command):
Expand Down

0 comments on commit df38dad

Please sign in to comment.