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

View File

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

View File

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