mirror of
https://github.com/volcengine/mediakit-cli.git
synced 2026-09-14 20:06:30 +08:00
28 lines
576 B
Go
28 lines
576 B
Go
//go:build !mediakit_cloud_only
|
|
|
|
package config
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
func DetectShellProfile(home string) (string, error) {
|
|
if runtime.GOOS == "windows" {
|
|
return "", errors.New("automatic shell profile updates are not supported on windows")
|
|
}
|
|
|
|
shell := strings.ToLower(os.Getenv("SHELL"))
|
|
switch {
|
|
case strings.Contains(shell, "zsh"):
|
|
return filepath.Join(home, ".zshrc"), nil
|
|
case strings.Contains(shell, "bash"):
|
|
return filepath.Join(home, ".bashrc"), nil
|
|
default:
|
|
return filepath.Join(home, ".zshrc"), nil
|
|
}
|
|
}
|