<commit_before>###
# Output usage information
###
function _zulu_upgrade_usage() {
  echo $(_zulu_color yellow "Usage:")
  echo "  zulu upgrade [<packages...>]"
  echo
  echo $(_zulu_color yellow "Options:")
  echo "  -c, --check             Check if upgrades are available"
  echo "  -h, --help              Output this help text and exit"
  echo "  -y, --no-confirmation   Do not ask for confirmation before upgrading"
}

###
# Upgrade a package
###
function _zulu_upgrade_package() {
  local package json repo dir file link oldpwd=$(pwd)

  package="$1"

  # Don't let zvm change the ZSH version for use while we're checking
  local old_ZVM_AUTO_USE=${ZVM_AUTO_USE}
  unset ZVM_AUTO_USE

  # Pull from the repository
  cd "$base/packages/$package"

  git rebase origin && git submodule update --init --recursive

  cd $oldpwd

  # Restore the ZVM_AUTO_USE setting
  export ZVM_AUTO_USE=${old_ZVM_AUTO_USE}
}

###
# Zulu command to handle package upgrades
###
function _zulu_upgrade() {
  local base index out count down oldpwd i input no_confirmation
  local -a packages to_update
  local -A _pids

  # Parse options
  zparseopts -D h=help -help=help \
                c=check -check=check \
                y=no_confirmation -no-confirmation=no_confirmation<commit_msg>Perform a safer rebase when updating packages<commit_after>###
# Output usage information
###
function _zulu_upgrade_usage() {
  echo $(_zulu_color yellow "Usage:")
  echo "  zulu upgrade [<packages...>]"
  echo
  echo $(_zulu_color yellow "Options:")
  echo "  -c, --check             Check if upgrades are available"
  echo "  -h, --help              Output this help text and exit"
  echo "  -y, --no-confirmation   Do not ask for confirmation before upgrading"
}

###
# Upgrade a package
###
function _zulu_upgrade_package() {
  local package json repo dir file link oldpwd=$(pwd)

  package="$1"

  # Don't let zvm change the ZSH version for use while we're checking
  local old_ZVM_AUTO_USE=${ZVM_AUTO_USE}
  unset ZVM_AUTO_USE

  # Pull from the repository
  cd "$base/packages/$package"

  git rebase -p --autostash FETCH_HEAD && git submodule update --init --recursive

  cd $oldpwd

  # Restore the ZVM_AUTO_USE setting
  export ZVM_AUTO_USE=${old_ZVM_AUTO_USE}
}

###
# Zulu command to handle package upgrades
###
function _zulu_upgrade() {
  local base index out count down oldpwd i input no_confirmation
  local -a packages to_update
  local -A _pids

  # Parse options
  zparseopts -D h=help -help=help \
                c=check -check=check \
                y=no_confirmation -no-confirmation=no_confirmation
{'fraction_non_alphanumeric': 0.09742010011551791, 'fraction_numerical': 0.0007701193685021178, 'mean_word_length': 3.2175324675324677, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3916421', 'n_tokens_mistral': 861, 'n_tokens_neox': 828, 'n_words': 273}