Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/utils
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/utils')
-rw-r--r--archinstall/lib/utils/util.py23
1 files changed, 22 insertions, 1 deletions
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