We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent db6c0e8 commit 42b4c61Copy full SHA for 42b4c61
2 files changed
functions/index.sh
@@ -2,6 +2,7 @@
2
source $dotfile_dir/functions/shared/validators.sh
3
4
source $dotfile_dir/functions/shared/join_args.sh
5
+source $dotfile_dir/functions/shared/has_flag.sh
6
7
# Barrel file for functions
8
source $dotfile_dir/functions/localhost.sh
functions/shared/has_flag.sh
@@ -0,0 +1,26 @@
1
+# Helper function to determine if a bash function contains a flag
+has_flag() {
+ local flag="$1"
+ shift
+
+ for arg in "$@"; do
+ if [ "$arg" = "$flag" ]; then
+ return 0 # found
9
+ fi
10
+ done
11
12
+ return 1 # not found
13
+}
14
15
+# Helper function to strip flags from args
16
+strip_flags() {
17
+ local result=()
18
19
20
+ if [[ "$arg" != -* ]]; then
21
+ result+=("$arg")
22
23
24
25
+ echo "${result[@]}"
26
0 commit comments