Skip to content

Commit

Permalink
Merge pull request tfutils#152 from amontalban/fix_ls_macos
Browse files Browse the repository at this point in the history
Fix bug on MacOS when using CLICOLOR=1
  • Loading branch information
Zordrak authored May 27, 2020
2 parents 5d94b99 + 6a877b8 commit 4f1ef20
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: generic
env:
- CLICOLOR=1
matrix:
include:
- os: windows
Expand All @@ -10,9 +12,13 @@ matrix:
- os: linux
dist: trusty
- os: osx
osx_image: xcode11.3
osx_image: xcode11.4
- os: osx
osx_image: xcode11.2 # OS X 10.14
- os: osx
osx_image: xcode10.3
- os: osx
osx_image: xcode10.1 # OS X 10.13
- os: osx
osx_image: xcode9.4
script:
Expand Down
5 changes: 3 additions & 2 deletions libexec/tfenv-list
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ print_version () {
};

log 'debug' 'Listing versions...';
local_versions=($(ls -1 "${TFENV_ROOT}/versions" \
local_versions=($(\find "${TFENV_ROOT}/versions" -type d -exec basename {} \; \
| tail -n +2 \
| sort -t'.' -k 1nr,1 -k 2nr,2 -k 3nr,3));

log 'debug' "Local versions: ${local_versions[@]}";

log 'debug' 'Printing versions...';
for local_version in ${local_versions[@]}; do
print_version "${local_version}";
done;
done;
3 changes: 2 additions & 1 deletion libexec/tfenv-use
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ declare version="${resolved%%\:*}";
declare regex="${resolved##*\:}";

log 'debug' "Searching ${TFENV_ROOT}/versions for latest version matching ${regex}";
declare version="$(\ls "${TFENV_ROOT}/versions" \
declare version="$(\find "${TFENV_ROOT}/versions" -type d -exec basename {} \; \
| tail -n +2 \
| sort -t'.' -k 1nr,1 -k 2nr,2 -k 3nr,3 \
| grep -e "${regex}" \
| head -n 1
Expand Down
3 changes: 2 additions & 1 deletion libexec/tfenv-version-name
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ if [[ "${TFENV_VERSION}" =~ ^latest.*$ ]]; then
log 'debug' "'latest' keyword does not use regex";
fi;

version="$(\ls "${TFENV_ROOT}/versions" \
version="$(\find "${TFENV_ROOT}/versions" -type d -exec basename {} \; \
| tail -n +2 \
| sort -t'.' -k 1nr,1 -k 2nr,2 -k 3nr,3 \
| grep -e "${regex}" \
| head -n 1)";
Expand Down

0 comments on commit 4f1ef20

Please sign in to comment.