blob: fe6e9d11dbcd2bca643d5add65b666bd15775cd6 [file] [log] [blame]
Joey Armstrong6890fa92024-08-15 12:14:37 -04001#!/bin/bash
2## -----------------------------------------------------------------------
3## -----------------------------------------------------------------------
4
5## -----------------------------------------------------------------------
6## Intent: Detect if the --{labels,required}-is-empty switch is valid
7## -----------------------------------------------------------------------
8function is_switch_valid__is_empty()
9{
10 local raw="$1"; shift # --{foo}-is-empty
11
12 declare -a valid=()
13 valid+=('label')
14 valid+=('resolved')
15
16 # --required-is-empty => required
17 local val="$raw"
18 val="${val:2}" # remove prefix --
19 val="${val%-is-empty}" # remove suffix token-name
20
21 if [[ " ${valid[@]} " =~ " ${val} " ]]; then
22 is_empty+=("$val")
23 else
24 error "Detected invalid --is-empty switch [$arg]"
25 fi
26
27 return
28}
29
30: # ($?=0) for source $include
31
32# [EOF]