Skip to content

Commit 9c41d15

Browse files
committed
refactor(server): name the project list cell sanitizer instead of commenting it
1 parent 50eb98a commit 9c41d15

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎apps/server/src/cli/project.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,8 @@ const projectRenameCommand = Command.make("rename", {
579579
),
580580
);
581581

582+
const toTsvCell = (value: string) => value.replace(/[\t\r\n]/g, " ");
583+
582584
const projectListCommand = Command.make("list", projectLocationFlags).pipe(
583585
Command.withDescription("List projects."),
584586
Command.withHandler((flags) =>
@@ -589,10 +591,7 @@ const projectListCommand = Command.make("list", projectLocationFlags).pipe(
589591
? "No projects."
590592
: active
591593
.map((project) =>
592-
// Titles and paths may contain tabs or newlines; keep one row of three columns.
593-
[project.id, project.title, project.workspaceRoot]
594-
.map((field) => field.replace(/[\t\r\n]/g, " "))
595-
.join("\t"),
594+
[project.id, project.title, project.workspaceRoot].map(toTsvCell).join("\t"),
596595
)
597596
.join("\n"),
598597
);

0 commit comments

Comments
 (0)