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:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-06-05 18:02:49 +1000
committerGitHub <noreply@github.com>2023-06-05 10:02:49 +0200
commit06eadb31d4f0bca0c8cb95b6a9eb62ddd2d7cff2 (patch)
tree07a7ed675d125703346fa343f1aa9e5e4129dd5f /archinstall/lib/utils
parent5276d95339368210e75791e2b88c1bf5aca4517b (diff)
Move locales and cleanup menu (#1814)
* Cleanup imports and unused code * Cleanup imports and unused code * Update build check * Keep deprecation exception * Simplify logging * Move locale into new sub-menu --------- Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
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