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
|
||||
done
|
||||
# Early hook for help
|
||||
[ -n "$_opthelp" ] && printhelp && exit 0
|
||||
# Parse out a config file if it exists
|
||||
if [ -f "$_optconfigfile" ]; then
|
||||
log "Loading config file" 2
|
||||
@ -370,30 +372,30 @@ main() {
|
||||
_args+=("$arg")
|
||||
done
|
||||
# Validate critical options
|
||||
(
|
||||
for backend in ${_supportedbackends[@]}; do
|
||||
if [ "$backend" = "${_config[backend]}" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
) || error "Unsupported backend: ${_config[backend]}" 50
|
||||
if [ -z "$_optmachinemode" ] && ! backend-validate; then
|
||||
errorcode=$?
|
||||
case $errorcode in
|
||||
1)
|
||||
error "Missing dependency for backend ${_config[backend]}: $_return" 50
|
||||
;;
|
||||
*)
|
||||
error "Backend error: $errorcode: $_return" 50
|
||||
;;
|
||||
esac
|
||||
if [ -z "$_optmachinemode" ]; then
|
||||
# Ensure we have a good backend, assuming we're not in a scripting mode
|
||||
(
|
||||
for backend in ${_supportedbackends[@]}; do
|
||||
if [ "$backend" = "${_config[backend]}" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
) || error "Unsupported backend: ${_config[backend]}" 50
|
||||
# Ensure we meet its requirements
|
||||
if ! backend-validate; then
|
||||
errorcode=$?
|
||||
case $errorcode in
|
||||
1)
|
||||
error "Missing dependency for backend ${_config[backend]}: $_return" 50
|
||||
;;
|
||||
*)
|
||||
error "Backend error: $errorcode: $_return" 50
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
# Pre-really-do-stuff hooks like help text
|
||||
[ -n "$_opthelp" ] && printhelp && exit 0
|
||||
|
||||
# Ensure we're ready to do the do
|
||||
# Validate core program dependencies
|
||||
log "Validating dependencies" 2
|
||||
if ! has youtube-dl pgrep; then
|
||||
error "Failed to find program: $_return" 1
|
||||
|
Loading…
Reference in New Issue
Block a user