feat: add a shell function to check if a plugin trigger exists

This commit is contained in:
Jose Diaz-Gonzalez
2023-08-19 12:07:06 -04:00
parent 4a43eeaaa8
commit ffc64e7d8b
2 changed files with 20 additions and 0 deletions

View File

@@ -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"

View File

@@ -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)