MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / detectShell

Function detectShell

source code/utils/completionCache.ts:26–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26function detectShell(): ShellInfo | null {
27 const shell = process.env.SHELL || ''
28 const home = homedir()
29 const claudeDir = join(home, '.claude')
30
31 if (shell.endsWith('/zsh') || shell.endsWith('/zsh.exe')) {
32 const cacheFile = join(claudeDir, 'completion.zsh')
33 return {
34 name: 'zsh',
35 rcFile: join(home, '.zshrc'),
36 cacheFile,
37 completionLine: `[[ -f "${cacheFile}" ]] && source "${cacheFile}"`,
38 shellFlag: 'zsh',
39 }
40 }
41 if (shell.endsWith('/bash') || shell.endsWith('/bash.exe')) {
42 const cacheFile = join(claudeDir, 'completion.bash')
43 return {
44 name: 'bash',
45 rcFile: join(home, '.bashrc'),
46 cacheFile,
47 completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`,
48 shellFlag: 'bash',
49 }
50 }
51 if (shell.endsWith('/fish') || shell.endsWith('/fish.exe')) {
52 const xdg = process.env.XDG_CONFIG_HOME || join(home, '.config')
53 const cacheFile = join(claudeDir, 'completion.fish')
54 return {
55 name: 'fish',
56 rcFile: join(xdg, 'fish', 'config.fish'),
57 cacheFile,
58 completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`,
59 shellFlag: 'fish',
60 }
61 }
62 return null
63}
64
65function formatPathLink(filePath: string): string {
66 if (!supportsHyperlinks()) {

Callers 2

setupShellCompletionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected