refactor: dedupe cli lowercase helpers

This commit is contained in:
Peter Steinberger
2026-04-07 17:35:58 +01:00
parent cebfa70277
commit 1a3f141215
28 changed files with 96 additions and 63 deletions

View File

@@ -4,6 +4,7 @@ import path from "node:path";
import { Command, Option } from "commander";
import { resolveStateDir } from "../config/paths.js";
import { routeLogsToStderr } from "../logging/console.js";
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
import { formatDocsLink } from "../terminal/links.js";
import { theme } from "../terminal/theme.js";
import { pathExists } from "../utils.js";
@@ -24,7 +25,7 @@ function isCompletionShell(value: string): value is CompletionShell {
export function resolveShellFromEnv(env: NodeJS.ProcessEnv = process.env): CompletionShell {
const shellPath = env.SHELL?.trim() ?? "";
const shellName = shellPath ? path.basename(shellPath).toLowerCase() : "";
const shellName = shellPath ? normalizeLowercaseStringOrEmpty(path.basename(shellPath)) : "";
if (shellName === "zsh") {
return "zsh";
}