-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadapter.sh
executable file
·27 lines (22 loc) · 949 Bytes
/
adapter.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# -*- coding: utf-8, tab-width: 2 -*-
function cli_main () {
export LANG{,UAGE}=en_US.UTF-8 # make error messages search engine-friendly
local DBGLV="${DEBUGLEVEL:-0}"
local DBA_PATH="$(readlink -m -- "$BASH_SOURCE"/..)"
# ^-- DBA = <D>OI <b>ot <a>dapter
local BOT_FUNCD="$DBA_PATH/botfuncs"
cd -- "$DBA_PATH" || return $?
local -A CFG=() STATE=()
CFG[task]="${1:-update_doi_meta_for_one_anno_on_stdin}"; shift
source -- "$BOT_FUNCD"/bot_init.sh || return $?
source_these_libs "$BOT_FUNCD"/*.sh || return $?
source_these_libs "$DBA_PATH"/src/*.sh || return $?
bot_init_before_config || return $?
source_in_func "$BOT_FUNCD"/cfg.default.rc || return $?
source_in_func "$DBA_PATH"/src/cfg.default.rc || return $?
load_host_config datacite || return $?
"${CFG[task]}" "$@" || return $?$(echo E: "Adapter task failed (rv=$?):$(
printf ' ‹%s›' "${CFG[task]}" "$@")" >&2)
}
cli_main "$@"; exit $?