Просмотр исходного кода

Checked all exit calls use exit flags, changed some -z, etc to my isEmpty or isNotEmpy functions

master
Gustavo Neves 8 лет назад
Родитель
Сommit
442579b87f
1 измененных файлов: 4 добавлений и 4 удалений
  1. +4
    -4
      pdfScale.sh

+ 4
- 4
pdfScale.sh Просмотреть файл

@@ -272,7 +272,7 @@ pageResize() {


# Parse a forced mode of operation # Parse a forced mode of operation
parseMode() { parseMode() {
if [[ -z $1 ]]; then
if isEmpty "$1"; then
printError "Mode is empty, please specify the desired mode" printError "Mode is empty, please specify the desired mode"
printError "Falling back to adaptive mode!" printError "Falling back to adaptive mode!"
ADAPTIVEMODE=$TRUE ADAPTIVEMODE=$TRUE
@@ -952,7 +952,7 @@ Examples:
# Prints usage info # Prints usage info
usage() { usage() {
[[ "$2" != 'nobanner' ]] && printVersion 2 [[ "$2" != 'nobanner' ]] && printVersion 2
[[ ! -z "$1" ]] && printError "$1"
isNotEmpty "$1" && printError "$1"
printError "Usage: $PDFSCALE_NAME [-v] [-s <factor>] [-m <mode>] <inFile.pdf> [outfile.pdf]" printError "Usage: $PDFSCALE_NAME [-v] [-s <factor>] [-m <mode>] <inFile.pdf> [outfile.pdf]"
printError "Try: $PDFSCALE_NAME -h # for help" printError "Try: $PDFSCALE_NAME -h # for help"
} }
@@ -960,7 +960,7 @@ usage() {


# Prints Verbose information # Prints Verbose information
vprint() { vprint() {
[[ $VERBOSE -eq 0 ]] && return 0
[[ $VERBOSE -eq 0 ]] && return $TRUE
timestamp="" timestamp=""
[[ $VERBOSE -gt 1 ]] && timestamp="$(date +%Y-%m-%d:%H:%M:%S) | " [[ $VERBOSE -gt 1 ]] && timestamp="$(date +%Y-%m-%d:%H:%M:%S) | "
echo "$timestamp$1" echo "$timestamp$1"
@@ -985,7 +985,7 @@ printDependency() {
initError() { initError() {
local errStr="$1" local errStr="$1"
local exitStat=$2 local exitStat=$2
[[ -z "$exitStat" ]] && exitStat=$EXIT_ERROR
isEmpty "$exitStat" && exitStat=$EXIT_ERROR
usage "ERROR! $errStr" "$3" usage "ERROR! $errStr" "$3"
exit $exitStat exit $exitStat
} }


Загрузка…
Отмена
Сохранить