#!/usr/bin/env zsh
# Wrapper script to run AWS CLI commands with awsume credentials
# Usage: aws-with-awsume <profile> <aws-command> [args...]

if [ "$#" -lt 2 ]; then
    echo "Usage: aws-with-awsume <profile> <aws-command> [args...]" >&2
    echo "Example: aws-with-awsume prod s3 ls" >&2
    exit 1
fi

PROFILE="$1"
shift

# Disable terminal escape sequences
export TERM=dumb
unsetopt PROMPT_SP 2>/dev/null

# Source zshrc to get awsume alias (suppress output)
source ~/.zshrc >/dev/null 2>&1

# Run awsume to set credentials in this shell (suppress all output)
. awsume "$PROFILE" >/dev/null 2>&1

# Run the AWS command with the credentials
aws "$@" 2>&1
