MCPcopy
hub / github.com/direnv/direnv / DetectShell

Function DetectShell

internal/cmd/shell.go:52–64  ·  view source on GitHub ↗

DetectShell returns a Shell instance from the given target. target is usually $0 and can also be prefixed by `-`

(target string)

Source from the content-addressed store, hash-verified

50//
51// target is usually $0 and can also be prefixed by `-`
52func DetectShell(target string) Shell {
53 target = filepath.Base(target)
54 // $0 starts with "-"
55 if target[0:1] == "-" {
56 target = target[1:]
57 }
58
59 detectedShell, isValid := supportedShellList[target]
60 if isValid {
61 return detectedShell
62 }
63 return nil
64}

Callers 8

watchDirCommandFunction · 0.85
watchListCommandFunction · 0.85
cmdWatchActionFunction · 0.85
cmdDumpActionFunction · 0.85
exportCommandFunction · 0.85
cmdHookActionFunction · 0.85
cmdDotEnvActionFunction · 0.85
TestShellDetectionFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestShellDetectionFunction · 0.68