Added is_empty_var

This commit is contained in:
Varun 2020-10-22 13:19:59 +05:30
parent 41dad168e3
commit cfa56adf5b
No known key found for this signature in database
GPG key ID: 93FB46DCF16E0D6F
2 changed files with 18 additions and 18 deletions

View file

@ -38,27 +38,19 @@ GH_LOG::log('Hello World');
# Configure GIT Username & EMail
# Defaults To "Github Action Bot" "githubactionbot@gmail.com"
gitconfig "Git Commit Username" "Git Commit Email"
# Install Bash Script In AlpineOS
installbash
# Install Curl In AlpineOS
installcurl
# Install Git In AlpineOS
# Installed By Default if setup-alpine.sh script used
installgit
# Install wget In AlpineOS
# Installed By Default if setup-alpine.sh script used
installwget
# Install unzip In AlpineOS
# Installed By Default if setup-alpine.sh script used
installunzip
```
### Shell Functions
#### `is_empty_var`
```shell script
# Below Will Output DEFAULT_NAME if $NAME is not set / empty
echo "$(is_empty_var "${NAME}" "DEFAULT_NAME")"
# Below Will Output 43 as $AGE is set
AGE="43"
echo "$(is_empty_var "${AGE}" "33")"
```
#### `gh_set_output`
```shell script
# {KEY} Custom Output Key

View file

@ -11,3 +11,11 @@ gh_set_output() {
gh_mask_output() {
echo "::add-mask::${1}"
}
is_empty_var(){
if [ -z "$1" ]; then
echo "$2"
else
echo "$1"
fi
}