Skip to content

Commit

Permalink
runner: follow 'source' files when parsing aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
abenz1267 committed Feb 6, 2025
1 parent 62ea7e7 commit 1a82ece
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/modules/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,13 @@ func (r *Runner) parseAliases() {

r.aliases = make(map[string]string)

file, err := os.Open(r.config.ShellConfig)
r.parseAliasesFunc(r.config.ShellConfig)
}

func (r *Runner) parseAliasesFunc(src string) {
homeDir, _ := os.UserHomeDir()

file, err := os.Open(src)
if err != nil {
log.Println(err)
return
Expand All @@ -225,5 +231,12 @@ func (r *Runner) parseAliases() {
r.aliases[alias] = strings.TrimSuffix(strings.TrimPrefix(splits[1], "'"), "'")
}
}

if strings.HasPrefix(text, "source") {
file := strings.Split(text, " ")[1]
file = strings.Replace(file, "~", homeDir, 1)

r.parseAliasesFunc(file)
}
}
}

0 comments on commit 1a82ece

Please sign in to comment.