Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ocrd/bashlib/src/parse_argv.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ ocrd__parse_argv () {
ocrd__raise "Must set \$params (declare -A params)"
fi

if [[ $# = 0 ]];then
ocrd__usage
exit 1
fi

ocrd__argv[overwrite]=false
ocrd__argv[mets_file]="$PWD/mets.xml"

local __parameters=()
local __parameter_overrides=()
Expand All @@ -42,9 +48,8 @@ ocrd__parse_argv () {
shift
done

if [[ ! -r "${ocrd__argv[mets_file]:=$PWD/mets.xml}" ]];then
ocrd__usage
exit 1
if [[ ! -e "${ocrd__argv[mets_file]}" ]];then
ocrd__raise "METS file '${ocrd__argv[mets_file]}' not found"
fi

if [[ ! -d "${ocrd__argv[working_dir]:=$(dirname "${ocrd__argv[mets_file]}")}" ]];then
Expand Down
11 changes: 8 additions & 3 deletions ocrd/ocrd/lib.bash
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ ocrd__parse_argv () {
ocrd__raise "Must set \$params (declare -A params)"
fi

if [[ $# = 0 ]];then
ocrd__usage
exit 1
fi

ocrd__argv[overwrite]=false
ocrd__argv[mets_file]="$PWD/mets.xml"

local __parameters=()
local __parameter_overrides=()
Expand All @@ -130,9 +136,8 @@ ocrd__parse_argv () {
shift
done

if [[ ! -r "${ocrd__argv[mets_file]:=$PWD/mets.xml}" ]];then
ocrd__usage
exit 1
if [[ ! -e "${ocrd__argv[mets_file]}" ]];then
ocrd__raise "METS file '${ocrd__argv[mets_file]}' not found"
fi

if [[ ! -d "${ocrd__argv[working_dir]:=$(dirname "${ocrd__argv[mets_file]}")}" ]];then
Expand Down