瀏覽代碼

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

master
Gustavo Neves 8 年之前
父節點
當前提交
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
} }


Loading…
取消
儲存