@barekey/cli 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,8 +78,17 @@ async function renderAvatarLines(imageUrl) {
78
78
  }
79
79
  lines.push(`${line}\u001b[0m`);
80
80
  }
81
+ while (lines.length > 0 && isBlankAvatarLine(lines[0] ?? "")) {
82
+ lines.shift();
83
+ }
84
+ while (lines.length > 0 && isBlankAvatarLine(lines[lines.length - 1] ?? "")) {
85
+ lines.pop();
86
+ }
81
87
  return lines;
82
88
  }
89
+ function isBlankAvatarLine(line) {
90
+ return line.replace(/\u001b\[[0-9;]*m/g, "").trim().length === 0;
91
+ }
83
92
  function joinAvatarAndText(avatarLines, textLines) {
84
93
  const totalRows = Math.max(avatarLines.length, textLines.length);
85
94
  const renderedRows = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barekey/cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Barekey command line interface",
5
5
  "type": "module",
6
6
  "bin": {
@@ -107,9 +107,20 @@ async function renderAvatarLines(imageUrl: string): Promise<Array<string>> {
107
107
  lines.push(`${line}\u001b[0m`);
108
108
  }
109
109
 
110
+ while (lines.length > 0 && isBlankAvatarLine(lines[0] ?? "")) {
111
+ lines.shift();
112
+ }
113
+ while (lines.length > 0 && isBlankAvatarLine(lines[lines.length - 1] ?? "")) {
114
+ lines.pop();
115
+ }
116
+
110
117
  return lines;
111
118
  }
112
119
 
120
+ function isBlankAvatarLine(line: string): boolean {
121
+ return line.replace(/\u001b\[[0-9;]*m/g, "").trim().length === 0;
122
+ }
123
+
113
124
  function joinAvatarAndText(
114
125
  avatarLines: Array<string>,
115
126
  textLines: Array<string>,