diff --git a/core/api/shell/package/functions b/core/api/shell/package/functions index 0c944ee3..2a261dfb 100644 --- a/core/api/shell/package/functions +++ b/core/api/shell/package/functions @@ -46,6 +46,9 @@ package() do _token="$1" && shift case "${_token}" in + (cli) + _command=cli + ;; (is) _command=is case "$1" in @@ -145,8 +148,9 @@ package() esac done + true ${package_name:=${extension}} + [[ -n "${package_name}" ]] || fail "Package name must be set/given" - [[ -n "${package_version}" ]] || fail "Package version must be set/given" case "${_command}" in (make) @@ -162,7 +166,7 @@ package() (is) case "$_subcommand" in (active|installed) - __sm.package.is.${_subcommand} + __sm.package.is.${_subcommand} "${_params[@]}" ;; esac ;; diff --git a/core/api/shell/variables/functions b/core/api/shell/variables/functions index 2970969d..5846bddd 100644 --- a/core/api/shell/variables/functions +++ b/core/api/shell/variables/functions @@ -1,5 +1,7 @@ #!/bin/sh +variable() { variables "$@"; } + variables() { trace_filter variables @@ -7,6 +9,8 @@ variables() local _command _variables=() _type if __sm.string.starts.with.one.of "$* " \ + "is empty " \ + "is nonempty " \ "are empty " \ "are nonempty " \ "must be empty " \ @@ -47,9 +51,9 @@ variables() # TODO: Think through variables more... case "${_command}" in - (are.empty|are.nonempty) + (is.empty|is.nonempty|are.empty|are.nonempty) [[ -n "${_variables[*]}" ]] || error "No variable names given for validation" - __sm.variables.${_command} "${_variables[@]}" + __sm.variables.${_command/#is/are} "${_variables[@]}" ;; (must.be.empty|must.be.nonempty) [[ -n "${_variables[*]}" ]] || error "No variable names given for validation" diff --git a/core/internal/shell/package/functions b/core/internal/shell/package/functions index 01cf199f..844321fd 100644 --- a/core/internal/shell/package/functions +++ b/core/internal/shell/package/functions @@ -423,7 +423,7 @@ __sm.package.init() for variable in default_version base_url md5_url user do - if variable is empty package_${variable} + if variable is empty "package_${variable}" then config read file defaults from ${package_name} \ key ${variable} variable ${variable} prefix package @@ -432,7 +432,7 @@ __sm.package.init() for variable in website_url archive_format do - if variable is empty ${variable} + if variable is empty "${variable}" then config read file defaults from ${package_name} \ key ${variable} variable ${variable} @@ -810,7 +810,6 @@ __sm.package.patches.apply() done } - __sm.package.is.active() { local _name="${1:-}" _version="${2:-}" diff --git a/core/internal/shell/package/includes b/core/internal/shell/package/includes index b4c46b45..2f84eda8 100644 --- a/core/internal/shell/package/includes +++ b/core/internal/shell/package/includes @@ -5,3 +5,5 @@ api/os api/defaults api/templates api/user +api/variables +api/config