index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Daniel Girtler <blackrabbit256@gmail.com> | 2023-06-05 18:02:49 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-05 10:02:49 +0200 |
commit | 06eadb31d4f0bca0c8cb95b6a9eb62ddd2d7cff2 (patch) | |
tree | 07a7ed675d125703346fa343f1aa9e5e4129dd5f /archinstall/lib/utils | |
parent | 5276d95339368210e75791e2b88c1bf5aca4517b (diff) |
-rw-r--r-- | archinstall/lib/utils/util.py | 23 |
diff --git a/archinstall/lib/utils/util.py b/archinstall/lib/utils/util.py index 34716f4a..8df75ab1 100644 --- a/archinstall/lib/utils/util.py +++ b/archinstall/lib/utils/util.py @@ -1,6 +1,7 @@ from pathlib import Path -from typing import Any, TYPE_CHECKING, Optional +from typing import Any, TYPE_CHECKING, Optional, List +from ..output import FormattedOutput from ..output import info if TYPE_CHECKING: @@ -28,3 +29,23 @@ def is_subpath(first: Path, second: Path): return True except ValueError: return False + + +def format_cols(items: List[str], header: Optional[str]) -> str: + if header: + text = f'{header}:\n' + else: + text = '' + + nr_items = len(items) + if nr_items <= 5: + col = 1 + elif nr_items <= 10: + col = 2 + elif nr_items <= 15: + col = 3 + else: + col = 4 + + text += FormattedOutput.as_columns(items, col) + return text |