summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/utils/textUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/utils/textUtils.ts')
-rw-r--r--packages/cli/src/ui/utils/textUtils.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/cli/src/ui/utils/textUtils.ts b/packages/cli/src/ui/utils/textUtils.ts
new file mode 100644
index 00000000..12852865
--- /dev/null
+++ b/packages/cli/src/ui/utils/textUtils.ts
@@ -0,0 +1,18 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/**
+ * Calculates the maximum width of a multi-line ASCII art string.
+ * @param asciiArt The ASCII art string.
+ * @returns The length of the longest line in the ASCII art.
+ */
+export const getAsciiArtWidth = (asciiArt: string): number => {
+ if (!asciiArt) {
+ return 0;
+ }
+ const lines = asciiArt.split('\n');
+ return Math.max(...lines.map((line) => line.length));
+};