mirror of
https://github.com/mas-cli/mas
synced 2024-11-21 19:23:01 +00:00
Simplify defaults for unsupplied script arguments.
Partial #638 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
f1a9cde9fd
commit
7a260db279
4 changed files with 9 additions and 32 deletions
|
@ -50,21 +50,13 @@ if [[ "${DRY_RUN}" == 'true' ]]; then
|
|||
fi
|
||||
|
||||
# arg 1 - version tag
|
||||
if [[ -n "${1}" ]]; then
|
||||
MAS_VERSION="${1}"
|
||||
else
|
||||
MAS_VERSION="v$(script/version)"
|
||||
fi
|
||||
MAS_VERSION="${1:-"v$(script/version)"}"
|
||||
|
||||
echo "MAS_VERSION: ${MAS_VERSION}"
|
||||
|
||||
# arg 2 - revision (commit hash)
|
||||
if [[ -n "${2}" ]]; then
|
||||
REVISION="${2}"
|
||||
else
|
||||
# Derive revision from version. Fails if MAS_VERSION is not a tag.
|
||||
REVISION="$(git rev-parse "${MAS_VERSION}")"
|
||||
fi
|
||||
# If arg 2 wasn't supplied or is empty, obtain revision from ${MAS_VERSION} version tag
|
||||
REVISION="${2:-"$(git rev-parse "${MAS_VERSION}")"}"
|
||||
|
||||
echo "REVISION: ${REVISION}"
|
||||
|
||||
|
|
|
@ -20,21 +20,13 @@ if [[ "${#}" -gt 2 ]]; then
|
|||
fi
|
||||
|
||||
# arg 1 - version tag
|
||||
if [[ -n "${1}" ]]; then
|
||||
MAS_VERSION="${1}"
|
||||
else
|
||||
MAS_VERSION="v$(script/version)"
|
||||
fi
|
||||
MAS_VERSION="${1:-"v$(script/version)"}"
|
||||
|
||||
echo "MAS_VERSION: ${MAS_VERSION}"
|
||||
|
||||
# arg 2 - revision (commit hash)
|
||||
if [[ -n "${2}" ]]; then
|
||||
REVISION="${2}"
|
||||
else
|
||||
# Derive revision from version. Fails if MAS_VERSION is not a tag.
|
||||
REVISION="$(git rev-parse "${MAS_VERSION}")"
|
||||
fi
|
||||
# If arg 2 wasn't supplied or is empty, obtain revision from ${MAS_VERSION} version tag
|
||||
REVISION="${2:-"$(git rev-parse "${MAS_VERSION}")"}"
|
||||
|
||||
echo "REVISION: ${REVISION}"
|
||||
|
||||
|
|
|
@ -7,11 +7,7 @@
|
|||
#
|
||||
|
||||
# Override default prefix path with optional 1st arg
|
||||
if test -n "${1}"; then
|
||||
PREFIX="${1}"
|
||||
else
|
||||
PREFIX="$(brew --prefix)"
|
||||
fi
|
||||
PREFIX="${1:-"$(brew --prefix)"}"
|
||||
|
||||
echo "==> 🔥 Uninstalling mas from ${PREFIX}"
|
||||
|
||||
|
|
|
@ -32,11 +32,8 @@ fi
|
|||
MAS_VERSION="${1}"
|
||||
|
||||
# arg 2 - revision (commit hash)
|
||||
if [[ "${#}" -ge 2 ]]; then
|
||||
REVISION="${2}"
|
||||
else
|
||||
REVISION="$(git rev-parse "${MAS_VERSION}")"
|
||||
fi
|
||||
# If arg 2 wasn't supplied or is empty, obtain revision from ${MAS_VERSION} version tag
|
||||
REVISION="${2:-"$(git rev-parse "${MAS_VERSION}")"}"
|
||||
|
||||
echo "MAS_VERSION: ${MAS_VERSION}"
|
||||
echo "REVISION: ${REVISION}"
|
||||
|
|
Loading…
Reference in a new issue