1
0
forked from drath/libratbag

ratbagctl: use textwrap.indent instead of inventing the wheel ourselves

This commit is contained in:
Yaroslav Chvanov
2023-03-02 02:37:30 +03:00
parent 681153ad4d
commit ef2049643c

View File

@@ -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: