filters: append well known dirs to exec PATH
To allow referencing built-in filters without hard coding a path during installation, append the following folders to the exec PATH when running the filter commands: ~/.config/aerc/filters ~/.local/share/aerc/filters $PREFIX/share/aerc/filters /usr/share/aerc/filters If a filter script has the same name than a command in the default exec PATH, it will not shadow it. In that edge case, the absolute path to the filter script must be specified. Suggested-by: Teo Luppi <me@luppi.uk> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
This commit is contained in:
parent
9cf69747eb
commit
c95961fc74
5 changed files with 31 additions and 3 deletions
widgets
|
@ -577,6 +577,12 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig,
|
|||
}
|
||||
}
|
||||
if filter != nil {
|
||||
path, _ := os.LookupEnv("PATH")
|
||||
for _, dir := range config.SearchDirs {
|
||||
path += fmt.Sprintf(":%s/filters", dir)
|
||||
}
|
||||
filter.Env = os.Environ()
|
||||
filter.Env = append(filter.Env, fmt.Sprintf("PATH=%s", path))
|
||||
if pipe, err = filter.StdinPipe(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue