| # Copyright 2020 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| #### CATEGORY=Other |
| ### execute ffx - future fx |
| ## See fx ffx help for more information. |
| |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../lib/vars.sh || exit $? |
| fx-config-read |
| |
| if is-remote-workflow-device; then |
| "${FUCHSIA_BUILD_DIR}/host-tools/ffx" target add $(get-device-pair) |
| fi |
| |
| # NOTE: this could be improved if it knew enough about ffx args to |
| # short-circuit once it hits a command, but not all global flags take arguments |
| # (e.g. -v, --help), so it would be hard to keep those in sync. For now we |
| # accept the concession that something other than the global --target flag |
| # being spelled exactly --target as an argument is highly unlikely. |
| found_target=false |
| for arg in "$@"; do |
| if [[ "$arg" == "--target" ]]; then |
| found_target=true |
| break; |
| fi |
| done |
| |
| if ${found_target}; then |
| args=("$@") |
| else |
| # Note: the quotes around get-device-pair are critical, if no fx default |
| # device is set, we explicitly want to pass "" here. |
| args=(--target "$(get-device-pair)" "$@") |
| fi |
| |
| exec "${FUCHSIA_BUILD_DIR}/host-tools/ffx" "${args[@]}" |