mirror of
https://github.com/hassio-addons/bashio.git
synced 2025-05-06 20:11:24 +00:00
✨ Adds debug on/off check command
This commit is contained in:
parent
2346cddca2
commit
6cd2579672
2 changed files with 21 additions and 0 deletions
|
@ -54,6 +54,8 @@ source "${__BASHIO_LIB_DIR}/addons.sh"
|
||||||
source "${__BASHIO_LIB_DIR}/api.sh"
|
source "${__BASHIO_LIB_DIR}/api.sh"
|
||||||
# shellcheck source=config.sh
|
# shellcheck source=config.sh
|
||||||
source "${__BASHIO_LIB_DIR}/config.sh"
|
source "${__BASHIO_LIB_DIR}/config.sh"
|
||||||
|
# shellcheck source=debug.sh
|
||||||
|
source "${__BASHIO_LIB_DIR}/debug.sh"
|
||||||
# shellcheck source=exit.sh
|
# shellcheck source=exit.sh
|
||||||
source "${__BASHIO_LIB_DIR}/exit.sh"
|
source "${__BASHIO_LIB_DIR}/exit.sh"
|
||||||
# shellcheck source=hardware.sh
|
# shellcheck source=hardware.sh
|
||||||
|
|
19
lib/debug.sh
Normal file
19
lib/debug.sh
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# ==============================================================================
|
||||||
|
# Community Hass.io Add-ons: Bashio
|
||||||
|
# Bashio is an bash function library for use with Hass.io add-ons.
|
||||||
|
#
|
||||||
|
# It contains a set of commonly used operations and can be used
|
||||||
|
# to be included in add-on scripts to reduce code duplication across add-ons.
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Checks if we are currently running in debug mode, based on the log module.
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
bashio::debug() {
|
||||||
|
if [[ "${__BASHIO_LOG_LEVEL}" -lt "${__BASHIO_LOG_LEVEL_DEBUG}" ]]; then
|
||||||
|
return "${__BASHIO_EXIT_NOK}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return "${__BASHIO_EXIT_OK}"
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue