diff --git a/plugins/common/functions b/plugins/common/functions index f9a07f502..b9dd37dc0 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -225,6 +225,19 @@ fn-is-valid-app-name-old() { return 1 } +fn-plugn-trigger-exists() { + declare desc="checks if a plugn trigger exists" + declare TRIGGER_NAME="$1" + local exists + + exists="$("$PLUGIN_CORE_AVAILABLE_PATH/common/common" --quiet plugn-trigger-exists "$TRIGGER_NAME" || true)" + if [[ "$exists" == "true" ]]; then + return + fi + + return 1 +} + is_valid_app_name() { declare desc="verify that the app name matches naming restrictions" local APP="$1" diff --git a/plugins/common/src/common/common.go b/plugins/common/src/common/common.go index 25095fde1..1cd87b13d 100644 --- a/plugins/common/src/common/common.go +++ b/plugins/common/src/common/common.go @@ -53,6 +53,13 @@ func main() { appName = "--global" } fmt.Print(common.GetAppScheduler(appName)) + case "plugn-trigger-exists": + triggerName := flag.Arg(1) + if common.PlugnTriggerExists(triggerName) { + fmt.Print("true") + } else { + fmt.Print("false") + } case "verify-app-name": appName := flag.Arg(1) err = common.VerifyAppName(appName)