From 2fcaf2ef49291f7ce67f473f48db41f43be07e64 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 19 Aug 2019 20:25:34 +0200 Subject: [PATCH] :sparkles: Adds support for new addon options (#9) --- lib/addons.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/addons.sh b/lib/addons.sh index 25e541a..79894d5 100644 --- a/lib/addons.sh +++ b/lib/addons.sh @@ -209,6 +209,30 @@ function bashio::addon.name() { bashio::addons "${slug}" "addons.${slug}.name" '.name' } +# ------------------------------------------------------------------------------ +# Returns the hostname of an add-on. +# +# Arguments: +# $1 Add-on slug (optional, default: self) +# ------------------------------------------------------------------------------ +function bashio::addon.hostname() { + local slug=${1:-'self'} + bashio::log.trace "${FUNCNAME[0]}" "$@" + bashio::addons "${slug}" "addons.${slug}.hostname" '.hostname' +} + +# ------------------------------------------------------------------------------ +# Returns a list of DNS names for the add-on. +# +# Arguments: +# $1 Add-on slug (optional, default: self) +# ------------------------------------------------------------------------------ +function bashio::addon.dns() { + local slug=${1:-'self'} + bashio::log.trace "${FUNCNAME[0]}" "$@" + bashio::addons "${slug}" "addons.${slug}.dns" '.dns // empty | .[]' +} + # ------------------------------------------------------------------------------ # Returns the description of an add-on. # @@ -609,6 +633,18 @@ function bashio::addon.devices() { bashio::addons "${slug}" "addons.${slug}.devices" '.devices // empty | .[]' } +# ------------------------------------------------------------------------------ +# Returns if add-on provide his own udev support. +# +# Arguments: +# $1 Add-on slug (optional, default: self) +# ------------------------------------------------------------------------------ +function bashio::addon.udev() { + local slug=${1:-'self'} + bashio::log.trace "${FUNCNAME[0]}" "$@" + bashio::addons "${slug}" "addons.${slug}.udev" '.udev // false' +} + # ------------------------------------------------------------------------------ # Returns if UART was made available to the add-on. #