Browse Source

helper: Update docs for OS detection helpers

master
Indrajit Raychaudhuri 4 years ago committed by Indrajit Raychaudhuri
parent
commit
e391cf40af
  1. 5
      modules/helper/README.md
  2. 10
      modules/helper/init.zsh

5
modules/helper/README.md

@ -13,6 +13,11 @@ Functions @@ -13,6 +13,11 @@ Functions
- `is-callable` checks if a name is a command, function, or alias.
- `is-true` checks a boolean variable for "true".
- `coalesce` prints the first non-empty string in the arguments array.
- `is-darwin` checks if running on macOS Darwin.
- `is-linux` checks if running on Linux.
- `is-bsd` checks if running on BSD.
- `is-cygwin` checks if running on Cygwin (Windows).
- `is-termux` checks if running on Termux (Android).
Authors
-------

10
modules/helper/init.zsh

@ -30,27 +30,27 @@ function coalesce { @@ -30,27 +30,27 @@ function coalesce {
return 1
}
# is true on MacOS Darwin
# Checks if running on macOS Darwin.
function is-darwin {
[[ "$OSTYPE" == darwin* ]]
}
# is true on Linux's
# Checks if running on Linux.
function is-linux {
[[ "$OSTYPE" == linux* ]]
}
# is true on BSD's
# Checks if running on BSD.
function is-bsd {
[[ "$OSTYPE" == *bsd* ]]
}
# is true on Cygwin (Windows)
# Checks if running on Cygwin (Windows).
function is-cygwin {
[[ "$OSTYPE" == cygwin* ]]
}
# is true on termux (Android)
# Checks if running on termux (Android).
function is-termux {
[[ "$OSTYPE" == linux-android ]]
}

Loading…
Cancel
Save