#!/bin/bash

target=$(rustc --print target-list | fzf --cycle --header "Select build target:")

if [ -z "$target" ]; then
    echo "No target selected. Canceled."
    exit 1
fi

if [ -n "$1" ]; then
    cmd="$1"
    shift
else
    cmd="build"
fi

cross "$cmd" --target "$target" $@
