From d2cacbe2549ef8cc66aea8bbbb54afeebacfd4f7 Mon Sep 17 00:00:00 2001 From: cunoe Date: Tue, 31 Mar 2026 12:28:46 +0800 Subject: [PATCH] fix: align shell type definitions across commands (#13) --- src/commands/export.ts | 3 +-- src/types/common.ts | 2 +- src/utils/env/index.ts | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/commands/export.ts b/src/commands/export.ts index da1c0d4..51ed2cd 100644 --- a/src/commands/export.ts +++ b/src/commands/export.ts @@ -5,8 +5,7 @@ import { join } from 'path'; import { existsSync } from 'fs'; import { getEnvs } from '@/utils/com'; import { detectDefaultShell, detectInteractiveShellProgram, generateExportCommand } from '@/utils/env'; - -type ShellKind = 'sh' | 'cmd' | 'powershell'; +import { ShellKind } from '@/types/common'; interface ExportOptions { verbose?: boolean; diff --git a/src/types/common.ts b/src/types/common.ts index 163b1ad..645d65e 100644 --- a/src/types/common.ts +++ b/src/types/common.ts @@ -1,2 +1,2 @@ -export type ShellKind = 'sh' | 'cmd' | 'powershell'; +export type ShellKind = 'sh' | 'bash' | 'zsh' | 'fish' | 'cmd' | 'powershell'; export type EnvMap = Record; \ No newline at end of file diff --git a/src/utils/env/index.ts b/src/utils/env/index.ts index ec31ccd..b094e96 100644 --- a/src/utils/env/index.ts +++ b/src/utils/env/index.ts @@ -224,7 +224,7 @@ export async function unsetEnv(key: string | string[]): Promise { /** * 检测默认shell */ -export function detectDefaultShell(): string { +export function detectDefaultShell(): ShellKind { const shell = process.env.SHELL || process.env.COMSPEC || 'sh'; if (shell.includes('bash')) return 'bash';