#!/usr/bin/env bash
#-------------------------------------------------------------------------------
# Copyright (C) 2012-2019 British Crown (Met Office) & Contributors.
#-------------------------------------------------------------------------------
# NAME
#     rose app-upgrade
#
# SYNOPSIS
#     rose app-upgrade [OPTIONS] [VERSION]
#
# DESCRIPTION
#     Upgrade an application configuration using metadata upgrade macros.
#
#     Alternatively, show the available upgrade/downgrade versions:
#
#     * `=` indicates the current version.
#     * `*` indicates the default version to change to.
#
#     If an application contains optional configurations, loop through
#     each one, combine with the main, upgrade it, and re-create it as
#     a diff vs the upgraded main configuration.
#
# OPTIONS
#     --all-versions, -a
#         Use all tagged versions.
#     --config=DIR, -C DIR
#         Use configuration in `DIR` instead of `$PWD`.
#     --downgrade, -d
#         Downgrade the version instead of upgrade.
#     --meta-path=PATH, -M PATH
#         Prepend `PATH` to the metadata search path. (look here first).
#         This option can be used repeatedly to load multiple paths.
#     --non-interactive, --yes, -y
#         Switch off interactive prompting.
#     --output=DIR, -O DIR
#         The location of the output directory.
#     --quiet, -q
#         Reduce verbosity.
#
# ARGUMENTS
#     VERSION
#         A version to change to. If no version is specified, show available
#         versions. If `--non-interactive` is used, use the latest version
#         available. If `--non-interactive` and `--downgrade` are used, use
#         the earliest version available.
#
# ENVIRONMENT VARIABLES
#     optional ROSE_META_PATH
#         Prepend `$ROSE_META_PATH` to the metadata search path.
#-------------------------------------------------------------------------------
exec python2 -m rose.upgrade "$@"
