mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-18 21:18:00 +00:00
22 lines
452 B
Go
22 lines
452 B
Go
package tools
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
"path"
|
|
|
|
"github.com/ncarlier/webhookd/pkg/logger"
|
|
)
|
|
|
|
// ResolveScript is resolving the target script.
|
|
func ResolveScript(dir, name string) (string, error) {
|
|
script := path.Join(dir, fmt.Sprintf("%s.sh", name))
|
|
logger.Debug.Println("Resolving script: ", script, "...")
|
|
if _, err := os.Stat(script); os.IsNotExist(err) {
|
|
return "", errors.New("Script not found: " + script)
|
|
}
|
|
|
|
return script, nil
|
|
}
|