Skip to content

Commit

Permalink
Merge branch 'bashlib-param-parsing'
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Jun 18, 2018
2 parents 0e14d05 + c4c0633 commit 3495456
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion bashlib/src/parse_argv.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
ocrd__parse_argv () {

if ! declare -p "argv" >/dev/null 2>/dev/null ;then
ocrd__raise "Must set \$argv"
ocrd__raise "Must set \$argv (declare -A argv)"
fi

if ! declare -p "params" >/dev/null 2>/dev/null ;then
ocrd__raise "Must set \$params (declare -A params)"
fi


Expand Down Expand Up @@ -44,5 +48,8 @@ ocrd__parse_argv () {
if [[ "${argv[output_file_grp]}" = "" ]];then
argv[output_file_grp]="OCR-D-TEXT"
fi

eval `ocrd ocrd-tool "$OCRD_TOOL_JSON" tool "$OCRD_TOOL_NAME" parse-params -p "${argv[parameter]}"`

}

9 changes: 8 additions & 1 deletion ocrd/lib.bash
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ Options:
ocrd__parse_argv () {

if ! declare -p "argv" >/dev/null 2>/dev/null ;then
ocrd__raise "Must set \$argv"
ocrd__raise "Must set \$argv (declare -A argv)"
fi

if ! declare -p "params" >/dev/null 2>/dev/null ;then
ocrd__raise "Must set \$params (declare -A params)"
fi


Expand Down Expand Up @@ -98,6 +102,9 @@ ocrd__parse_argv () {
if [[ "${argv[output_file_grp]}" = "" ]];then
argv[output_file_grp]="OCR-D-TEXT"
fi

eval `ocrd ocrd-tool "$OCRD_TOOL_JSON" tool "$OCRD_TOOL_NAME" parse-params -p "${argv[parameter]}"`

}

# END-INCLUDE
Expand Down

0 comments on commit 3495456

Please sign in to comment.