From e391cf40af37780b0bc08bd9eb89e0c5095b66d6 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sun, 2 May 2021 01:00:06 -0500 Subject: [PATCH] helper: Update docs for OS detection helpers --- modules/helper/README.md | 5 +++++ modules/helper/init.zsh | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/helper/README.md b/modules/helper/README.md index 9f10d6e..cfe5c03 100644 --- a/modules/helper/README.md +++ b/modules/helper/README.md @@ -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 ------- diff --git a/modules/helper/init.zsh b/modules/helper/init.zsh index 0553556..0a33d7c 100644 --- a/modules/helper/init.zsh +++ b/modules/helper/init.zsh @@ -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 ]] }