<commit_before>#!/usr/bin/env bash

# Bootstrap Sheldon.
# shellcheck source=/dev/null
. "${0%/*}/../../lib/sheldon/bootstrap.sh"

# Use strict mode.
Sheldon.Core.Sheldon.strict

# Import required Sheldon modules.
import Sheldon.Util.Array as Array

# shellcheck disable=SC2154
# shellcheck disable=SC2086
# shellcheck disable=SC2034
something() {
  local -A options
  local -n __custom

  options=( ["key1"]="val1" ["key2"]="val2" ["key3"]="val3" )
  
  echo "Default options:"
  for opt in "${!options[@]}"; do
    echo "$opt => ${options[$opt]}"
  done
  echo

  __custom="${1}"
  echo "User options:"
  for cust in "${!__custom[@]}"; do
    echo "$cust => ${__custom[$cust]}"
  done
  echo

  $Array.update options __custom

  echo "Merged options:"
  for opt in "${!options[@]}"; do
    echo "$opt => ${options[$opt]}"
  done
  echo
}

declare -A custom
# shellcheck disable=SC2034
custom=( ["key2"]="custom value" ["another"]="foo" ["bar"]="baz" )
# Overwrite some values in 'something()' with values passed in via 'custom'.
something custom<commit_msg>Renamed function and added doc<commit_after>#!/usr/bin/env bash

# Bootstrap Sheldon.
# shellcheck source=/dev/null
. "${0%/*}/../../lib/sheldon/bootstrap.sh"

# Use strict mode.
Sheldon.Core.Sheldon.strict

# Import required Sheldon modules.
import Sheldon.Util.Array as Array

# shellcheck disable=SC2154
# shellcheck disable=SC2086
# shellcheck disable=SC2034
overwrite_values() {
  local -A options
  local -n __custom

  options=( ["key1"]="val1" ["key2"]="val2" ["key3"]="val3" )
  
  echo "Default options:"
  for opt in "${!options[@]}"; do
    echo "$opt => ${options[$opt]}"
  done
  echo

  __custom="${1}"
  echo "User options:"
  for cust in "${!__custom[@]}"; do
    echo "$cust => ${__custom[$cust]}"
  done
  echo

  $Array.update options __custom

  echo "Merged options:"
  for opt in "${!options[@]}"; do
    echo "$opt => ${options[$opt]}"
  done
  echo
}

declare -A custom
# shellcheck disable=SC2034
custom=( ["key2"]="custom value" ["another"]="foo" ["bar"]="baz" )
# Overwrite some values in 'overwrite_values()' with values passed in via 'custom'.
overwrite_values custom
{'fraction_non_alphanumeric': 0.1790352504638219, 'fraction_numerical': 0.023191094619666047, 'mean_word_length': 4.172661870503597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6537210', 'n_tokens_mistral': 778, 'n_tokens_neox': 740, 'n_words': 207}