MCPcopy Create free account
hub / github.com/diillson/chatcli / getShellConfigPath

Method getShellConfigPath

cli/agent/command_executor.go:254–271  ·  view source on GitHub ↗

getShellConfigPath retorna o caminho do arquivo de configuração do shell

(shell string)

Source from the content-addressed store, hash-verified

252
253// getShellConfigPath retorna o caminho do arquivo de configuração do shell
254func (e *CommandExecutor) getShellConfigPath(shell string) string {
255 shellName := filepath.Base(shell)
256 homeDir, err := os.UserHomeDir()
257 if err != nil {
258 return ""
259 }
260
261 switch shellName {
262 case "bash":
263 return filepath.Join(homeDir, ".bashrc")
264 case "zsh":
265 return filepath.Join(homeDir, ".zshrc")
266 case "fish":
267 return filepath.Join(homeDir, ".config", "fish", "config.fish")
268 default:
269 return ""
270 }
271}
272
273// validateShellConfig checks that a shell config file is safe to source.
274// It rejects symlinks (which could point to malicious files) and

Callers 1

executeInteractiveMethod · 0.95

Implementers 2

MockCommandExecutorutils/git_utils_test.go
OSCommandExecutorutils/exec_utils.go

Calls

no outgoing calls

Tested by

no test coverage detected