test_function() {
 echo $1
}

function copy_stdin() {
    printf "\033]52;c;%s\a" "$(base64 | tr -d '\n')"
}

make_and_change_dir() {
    mkdir -p "$1" && cd "$1" || exit
}

grab_latest_download() {
    download_dir="${HOME}/Downloads/Browser/"
    download_file="$(ls --level 3 --time created "$download_dir" | head -n 1)"
    echo "$download_dir$download_file"
}
add_and_commit_single_file() {
    [[ -z "$1" ]] && { echo "No file specified"; return 1; } #TODO use latest file?
    commit_message="$2"
    [[ -n "$2" ]] || { 
        echo "No commit message specified"
        read -r commit_message
        [[ -z "$commit_message" ]] && { echo "No commit message provided"; return 1; }
    }
    git add $1 && git commit -m "$commit_message" || { echo "Failed to add and commit $1"; return 1; }
}
