#!/bin/sh

# Exit if anything fails
set -e

lldb=lldb-8

# Prepare commands that will be loaded before any file on the command line has been loaded
script_import="command script import \"/usr/share/rust-lldb/lldb_rust_formatters.py\""
category_definition="type summary add --no-value --python-function lldb_rust_formatters.print_val -x \".*\" --category Rust"
category_enable="type category enable Rust"

# Call LLDB with the commands added to the argument list
exec "$lldb" --one-line-before-file="$script_import" \
    --one-line-before-file="$category_definition" \
    --one-line-before-file="$category_enable" \
    "$@"
