Reorganize pre-flight checks
Dude why the fuck did you have to have a valid backend to check the help text What was I smoking
This commit is contained in:
parent
bc414f08d8
commit
92c6e38c70
48
ptgdp
48
ptgdp
@ -349,6 +349,8 @@ main() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
# Early hook for help
|
||||||
|
[ -n "$_opthelp" ] && printhelp && exit 0
|
||||||
# Parse out a config file if it exists
|
# Parse out a config file if it exists
|
||||||
if [ -f "$_optconfigfile" ]; then
|
if [ -f "$_optconfigfile" ]; then
|
||||||
log "Loading config file" 2
|
log "Loading config file" 2
|
||||||
@ -370,30 +372,30 @@ main() {
|
|||||||
_args+=("$arg")
|
_args+=("$arg")
|
||||||
done
|
done
|
||||||
# Validate critical options
|
# Validate critical options
|
||||||
(
|
if [ -z "$_optmachinemode" ]; then
|
||||||
for backend in ${_supportedbackends[@]}; do
|
# Ensure we have a good backend, assuming we're not in a scripting mode
|
||||||
if [ "$backend" = "${_config[backend]}" ]; then
|
(
|
||||||
return 0
|
for backend in ${_supportedbackends[@]}; do
|
||||||
fi
|
if [ "$backend" = "${_config[backend]}" ]; then
|
||||||
done
|
return 0
|
||||||
return 1
|
fi
|
||||||
) || error "Unsupported backend: ${_config[backend]}" 50
|
done
|
||||||
if [ -z "$_optmachinemode" ] && ! backend-validate; then
|
return 1
|
||||||
errorcode=$?
|
) || error "Unsupported backend: ${_config[backend]}" 50
|
||||||
case $errorcode in
|
# Ensure we meet its requirements
|
||||||
1)
|
if ! backend-validate; then
|
||||||
error "Missing dependency for backend ${_config[backend]}: $_return" 50
|
errorcode=$?
|
||||||
;;
|
case $errorcode in
|
||||||
*)
|
1)
|
||||||
error "Backend error: $errorcode: $_return" 50
|
error "Missing dependency for backend ${_config[backend]}: $_return" 50
|
||||||
;;
|
;;
|
||||||
esac
|
*)
|
||||||
|
error "Backend error: $errorcode: $_return" 50
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Validate core program dependencies
|
||||||
# Pre-really-do-stuff hooks like help text
|
|
||||||
[ -n "$_opthelp" ] && printhelp && exit 0
|
|
||||||
|
|
||||||
# Ensure we're ready to do the do
|
|
||||||
log "Validating dependencies" 2
|
log "Validating dependencies" 2
|
||||||
if ! has youtube-dl pgrep; then
|
if ! has youtube-dl pgrep; then
|
||||||
error "Failed to find program: $_return" 1
|
error "Failed to find program: $_return" 1
|
||||||
|
Loading…
Reference in New Issue
Block a user