From ef2049643ca5b0e68753428aac37712658e4474c Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Thu, 2 Mar 2023 02:37:30 +0300 Subject: [PATCH] ratbagctl: use textwrap.indent instead of inventing the wheel ourselves --- tools/ratbagctl.body.py.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/ratbagctl.body.py.in b/tools/ratbagctl.body.py.in index 3832c198..45470741 100755 --- a/tools/ratbagctl.body.py.in +++ b/tools/ratbagctl.body.py.in @@ -25,6 +25,7 @@ import evdev import subprocess import sys import argparse +import textwrap from typing import Any, Callable, Dict, List, Optional, Tuple, Union # This must be on a single line, as we replace it using merge_ratbagd.py while building. @@ -1543,9 +1544,7 @@ class RatbagParserSwitch(RatbagParser): def _print_help(self, prefix: str) -> None: if self.help and self.group is not None: - help_lines = self.help.split("\n") - help_indented = "\n ".join(help_lines) - print(" ", help_indented, "\n") + print(textwrap.indent(self.help, " "), "\n") for e in self.switch: e.print_help(None, f"{prefix}{self.name} ") if self.N_access is not None: