Merge pull request #111 from opencultureconsulting/109-always-set-orcli-alias-in-run-and-test-commands

always set orcli alias
This commit is contained in:
Felix Lohmeier 2023-10-26 01:31:50 +02:00 committed by GitHub
commit f52b83896e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 28 deletions

20
orcli
View File

@ -1584,10 +1584,8 @@ orcli_test_command() {
for i in "${!files[@]}"; do for i in "${!files[@]}"; do
set +e # do not exit on failed tests set +e # do not exit on failed tests
bash -e <( bash -e <(
if ! command -v orcli &>/dev/null; then echo "shopt -s expand_aliases"
echo "shopt -s expand_aliases" echo "alias orcli=${scriptpath}/orcli"
echo "alias orcli=${scriptpath}/orcli"
fi
awk 1 "${files[$i]}" awk 1 "${files[$i]}"
) &>"$OPENREFINE_TMPDIR/test.log" ) &>"$OPENREFINE_TMPDIR/test.log"
results+=(${?}) results+=(${?})
@ -1877,9 +1875,7 @@ orcli_run_command() {
# case 1: interactive mode if stdin is selected but not present # case 1: interactive mode if stdin is selected but not present
bash --rcfile <( bash --rcfile <(
cat ~/.bashrc cat ~/.bashrc
if ! command -v orcli &>/dev/null; then echo "alias orcli=${scriptpath}/orcli"
echo "alias orcli=${scriptpath}/orcli"
fi
interactive interactive
) -i </dev/tty ) -i </dev/tty
exit exit
@ -1889,9 +1885,7 @@ orcli_run_command() {
# case 2: execute scripts and keep shell running # case 2: execute scripts and keep shell running
bash --rcfile <( bash --rcfile <(
cat ~/.bashrc cat ~/.bashrc
if ! command -v orcli &>/dev/null; then echo "alias orcli=${scriptpath}/orcli"
echo "alias orcli=${scriptpath}/orcli"
fi
for i in "${!files[@]}"; do for i in "${!files[@]}"; do
log "executing script ${files[$i]}..." log "executing script ${files[$i]}..."
awk 1 "${files[$i]}" awk 1 "${files[$i]}"
@ -1903,10 +1897,8 @@ orcli_run_command() {
for i in "${!files[@]}"; do for i in "${!files[@]}"; do
log "executing script ${files[$i]}..." log "executing script ${files[$i]}..."
bash -e <( bash -e <(
if ! command -v orcli &>/dev/null; then echo "shopt -s expand_aliases"
echo "shopt -s expand_aliases" echo "alias orcli=${scriptpath}/orcli"
echo "alias orcli=${scriptpath}/orcli"
fi
awk 1 "${files[$i]}" awk 1 "${files[$i]}"
) )
done done

View File

@ -73,9 +73,7 @@ if [[ ${args[file]} == '-' || ${args[file]} == '"-"' ]]; then
# case 1: interactive mode if stdin is selected but not present # case 1: interactive mode if stdin is selected but not present
bash --rcfile <( bash --rcfile <(
cat ~/.bashrc cat ~/.bashrc
if ! command -v orcli &>/dev/null; then echo "alias orcli=${scriptpath}/orcli"
echo "alias orcli=${scriptpath}/orcli"
fi
interactive interactive
) -i </dev/tty ) -i </dev/tty
exit exit
@ -85,9 +83,7 @@ if [[ ${args[--interactive]} ]]; then
# case 2: execute scripts and keep shell running # case 2: execute scripts and keep shell running
bash --rcfile <( bash --rcfile <(
cat ~/.bashrc cat ~/.bashrc
if ! command -v orcli &>/dev/null; then echo "alias orcli=${scriptpath}/orcli"
echo "alias orcli=${scriptpath}/orcli"
fi
for i in "${!files[@]}"; do for i in "${!files[@]}"; do
log "executing script ${files[$i]}..." log "executing script ${files[$i]}..."
awk 1 "${files[$i]}" awk 1 "${files[$i]}"
@ -99,10 +95,8 @@ else
for i in "${!files[@]}"; do for i in "${!files[@]}"; do
log "executing script ${files[$i]}..." log "executing script ${files[$i]}..."
bash -e <( bash -e <(
if ! command -v orcli &>/dev/null; then echo "shopt -s expand_aliases"
echo "shopt -s expand_aliases" echo "alias orcli=${scriptpath}/orcli"
echo "alias orcli=${scriptpath}/orcli"
fi
awk 1 "${files[$i]}" awk 1 "${files[$i]}"
) )
done done

View File

@ -54,10 +54,8 @@ results=()
for i in "${!files[@]}"; do for i in "${!files[@]}"; do
set +e # do not exit on failed tests set +e # do not exit on failed tests
bash -e <( bash -e <(
if ! command -v orcli &>/dev/null; then echo "shopt -s expand_aliases"
echo "shopt -s expand_aliases" echo "alias orcli=${scriptpath}/orcli"
echo "alias orcli=${scriptpath}/orcli"
fi
awk 1 "${files[$i]}" awk 1 "${files[$i]}"
) &>"$OPENREFINE_TMPDIR/test.log" ) &>"$OPENREFINE_TMPDIR/test.log"
results+=(${?}) results+=(${?})