Browse Source

implement functionExists()

master
belliash 7 years ago
parent
commit
1431fad33b
2 changed files with 14 additions and 0 deletions
  1. 9
    0
      libraries/common
  2. 5
    0
      modules/sample.ezmod

+ 9
- 0
libraries/common View File

@@ -72,6 +72,15 @@ function fail() {
72 72
 	fi
73 73
 }
74 74
 
75
+#-------------------------------------------------------------------------------
76
+# Checks if the given function has been defined
77
+# Parameters: %function%
78
+#-------------------------------------------------------------------------------
79
+function functionExists() {
80
+	type ${1} 2>/dev/null | grep -q "is a function"
81
+	return ${?}
82
+}
83
+
75 84
 #-------------------------------------------------------------------------------
76 85
 # Checks whether a defined variable contain specified element or not
77 86
 # Parameters: %element% %variable%

+ 5
- 0
modules/sample.ezmod View File

@@ -2,3 +2,8 @@ EZMOD_DESCRIPTION="Sample module for learning and testing purposes"
2 2
 EZMOD_COMPATIBILITY="ezbuild ezsync"
3 3
 EZMOD_AUTHOR="Rafal Kupiec"
4 4
 EZMOD_VERSION="0.1"
5
+
6
+ezsync_postsync() {
7
+	printWarn "fdgdfs"
8
+#	return 1
9
+}

Loading…
Cancel
Save