Skip to content

Commit

Permalink
Merge pull request #25 from secretGeek/ps-coop
Browse files Browse the repository at this point in the history
Implements issue #13
  • Loading branch information
doekman authored Apr 28, 2020
2 parents 7e1f603 + 3368d3c commit 9112d8d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
11 changes: 10 additions & 1 deletion ok.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ environment variables (for internal use):
if [ -z ${_OK_VERBOSE+x} ]; then local verbose=1; else local verbose=$_OK_VERBOSE; fi

# handle command line arguments now
local ok_file=".ok"
local ok_file=""
local args # Make sure no double space is added
if [[ -z "$*" ]]; then
args="ok"
Expand Down Expand Up @@ -147,6 +147,15 @@ environment variables (for internal use):
fi
shift
done
# When no ok_file supplied, check if a default one is readable
if [[ -z "$ok_file" ]]; then
for f in .ok-sh .ok; do
if [[ -r "$f" ]]; then
ok_file="$f"
break # found
fi
done
fi

if [[ $cmd == usage ]]; then
_ok_cmd_usage "$usage_error" || return $?
Expand Down
19 changes: 5 additions & 14 deletions test/.ok
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
# Control what python to use
_OK__PATH_TO_PYTHON=$(command -v python) # set python2
_OK__PATH_TO_PYTHON=$(command -v python3) # set python3
unset _OK__PATH_TO_PYTHON #test if this works too
echo "Path to python: '$_OK__PATH_TO_PYTHON'" # check path
$_OK__PATH_TO_PYTHON --version # check python version
# Control encoding or not
echo "Python IO Encoding: ${PYTHONIOENCODING:--=not-set=-}"
export PYTHONIOENCODING="UTF-8" # only python3 will choke on non-UTF-8, when this is set
unset PYTHONIOENCODING # nonetheless, python will treat everything as ASCII
# Go to the test cases
cd iso_latin_1
cd mac_os_roman
cd utf_8
# This `.ok` file should not be shown
# because `.ok-sh` should be used.
# `.ok-sh` takes precedence over `.ok` when both exists
cat .ok
cat .ok-sh
14 changes: 14 additions & 0 deletions test/.ok-sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Control what python to use
_OK__PATH_TO_PYTHON=$(command -v python) # set python2
_OK__PATH_TO_PYTHON=$(command -v python3) # set python3
unset _OK__PATH_TO_PYTHON #test if this works too
echo "Path to python: '$_OK__PATH_TO_PYTHON'" # check path
$_OK__PATH_TO_PYTHON --version # check python version
# Control encoding or not
echo "Python IO Encoding: ${PYTHONIOENCODING:--=not-set=-}"
export PYTHONIOENCODING="UTF-8" # only python3 will choke on non-UTF-8, when this is set
unset PYTHONIOENCODING # nonetheless, python will treat everything as ASCII
# Go to the test cases
cd iso_latin_1
cd mac_os_roman
cd utf_8
File renamed without changes.

0 comments on commit 9112d8d

Please sign in to comment.