84 lines
1.1 KiB
Plaintext
84 lines
1.1 KiB
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
|
||
|
|
||
|
####
|
||
|
# tllib init
|
||
|
####
|
||
|
|
||
|
export tllib_dir=/usr/share/tllib
|
||
|
export tllib_required=(tlmsg tlcm)
|
||
|
eval $(tllib-include)
|
||
|
|
||
|
# Set up tlmsg config from the outside
|
||
|
declare -A tlmsgconf
|
||
|
|
||
|
# Set up tlcm config array
|
||
|
declare -A tlcm_conf
|
||
|
|
||
|
# Setting default tlcm options
|
||
|
export tlcm_conf=(
|
||
|
[fpath]=$XDG_CONFIG_HOME/tl-testmedia.conf
|
||
|
)
|
||
|
####
|
||
|
|
||
|
|
||
|
####
|
||
|
# Runtime config init
|
||
|
####
|
||
|
|
||
|
# Set up runtime config array
|
||
|
#declare -A conf
|
||
|
|
||
|
####
|
||
|
|
||
|
|
||
|
####
|
||
|
# Option parsing
|
||
|
####
|
||
|
|
||
|
while getopts ":c:v:" opt; do
|
||
|
case $opt in
|
||
|
c)
|
||
|
export tlcm_conf[fpath]="$OPTARG"
|
||
|
;;
|
||
|
|
||
|
v)
|
||
|
# -vv
|
||
|
if [[ "$OPTARG" == "v" ]]; then
|
||
|
tlmsgconf[opmode]=2
|
||
|
# -vvv
|
||
|
elif [[ "$OPTARG" == "vv" ]]; then
|
||
|
tlmsgconf[opmode]=3
|
||
|
else
|
||
|
tlmsg -e "Incorrect verbosity level: $OPTARG"
|
||
|
fi
|
||
|
;;
|
||
|
:)
|
||
|
# -v
|
||
|
if [[ "$OPTARG" == "-v" ]]; then
|
||
|
export tlmsgconf[opmode]=1
|
||
|
else
|
||
|
tlmsg -e "Option requires argument: $OPTARG"
|
||
|
fi
|
||
|
;;
|
||
|
*)
|
||
|
tlmsg -e "Unknown option: $OPTARG"
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
####
|
||
|
|
||
|
|
||
|
if ! tlcm check; then
|
||
|
tlmsg -e "Unable to read config file: ${tlcm_conf[fpath]}"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
|
||
|
sync() {
|
||
|
:
|
||
|
}
|
||
|
|
||
|
$1
|