(shellPath string)
| 463 | } |
| 464 | |
| 465 | func GetShellTypeFromShellPath(shellPath string) string { |
| 466 | shellBase := filepath.Base(shellPath) |
| 467 | if strings.Contains(shellBase, "bash") { |
| 468 | return ShellType_bash |
| 469 | } |
| 470 | if strings.Contains(shellBase, "zsh") { |
| 471 | return ShellType_zsh |
| 472 | } |
| 473 | if strings.Contains(shellBase, "fish") { |
| 474 | return ShellType_fish |
| 475 | } |
| 476 | if strings.Contains(shellBase, "pwsh") || strings.Contains(shellBase, "powershell") { |
| 477 | return ShellType_pwsh |
| 478 | } |
| 479 | return ShellType_unknown |
| 480 | } |
| 481 | |
| 482 | var ( |
| 483 | bashVersionRegexp = regexp.MustCompile(`\bversion\s+(\d+\.\d+)`) |
no outgoing calls
no test coverage detected