client9 / shlib

portable functions for posix shell environments
The Unlicense
360 stars 36 forks source link

Fix Windows 10 support. #14

Closed AlekSi closed 5 years ago

AlekSi commented 5 years ago

Closes #13.

AlekSi commented 5 years ago

Travis CI failed for an unrelated reason, PTAL.

syntaqx commented 5 years ago

Excited to see this get merged.

syntaqx commented 5 years ago
uname_os() {
  os=$(uname -s | tr '[:upper:]' '[:lower:]')
  case "$os" in
    msys_nt*) os="windows" ;;
    mingw*) os="windows" ;;
  esac
  echo "$os"
}

You'll probably want something like this to be more friendly with git-bash.exe, which is the more common shell installation most people use (not the best, just most common)

Note: I have basically no practical knowledge of shell scripting, so I'm sure there's a more optimized way to write that - Functionally was all I was referring to.

codyaray commented 5 years ago

+1 also just ran into this issue for mingw* as well.

Please add this case and merge! :)

DABH commented 5 years ago

+1 for @syntaqx 's solution cc @client9 -- thanks for taking the time to fix this! (confirmed the fix works on win10 + git bash)

AlekSi commented 5 years ago

Updated PR with @syntaqx's solution.

@client9 Please find a minute to click merge button – it is a small change, it is tested by us, and fixes a real problem we are having.

AlekSi commented 5 years ago

Thank you!

client9 commented 5 years ago

@AlekSi and friends... I'd be happy to give you commit rights if you want! Windows is something I'm never going to be able to support!

syntaqx commented 5 years ago

@client9 If you need help with Windows support I'm happy to help. I work on Windows full time and fix this kind of stuff constantly :P

client9 commented 5 years ago

and it was so 💥

thanks @syntaqx

DABH commented 5 years ago

Same here, my company is now relying on this package so have a vested interest in keeping it working smoothly on all platforms :) Would be happy to help maintain. Thanks again for the fast reply and for merging! 💯

client9 commented 5 years ago

I'd love to know how you all are using it. @syntaqx @DABH !

DABH commented 5 years ago

In my case we have a cross-platform installer script for a software package, which users can curl ... | sh to download and install on their machines. So one can imagine how many of these scripts are useful :)

syntaqx commented 5 years ago

My first use case was when I was using https://goreleaser.com/ to automate binary releases for a Go project. They had the project as a dependency.

Now I use it for pretty much any scripting suite I deliver. I work in operations/devops/infrastructure so scripts and their compatibility is life.

codyaray commented 5 years ago

@syntaqx same here. @DABH and I discovered this via godownloader as well. Pretty nice suite. :)