<commit_before>#!/usr/bin/env bash
# @description WP CLI
set -eo pipefail

function wp_cli_setup() {
  vvv_info " * Installing/updating WP-CLI"
  # WP-CLI Install
  local exists_wpcli

  # Remove old wp-cli symlink, if it exists.
  if [[ -L "/usr/local/bin/wp" ]]; then
    vvv_info " * Removing old wp-cli symlink"
    rm -f /usr/local/bin/wp
  fi

  if [[ ! -f "/usr/local/bin/wp" ]]; then
    vvv_info " * Downloading wp-cli nightly, see <url>http://wp-cli.org</url>"
    noroot curl -sO https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar /tmp/wp-cli-nightly.phar
    chown -R vagrant:www-data /usr/local/bin
    noroot mv -f /tmp/wp-cli-nightly.phar /usr/local/bin/wp
    chmod +x /usr/local/bin/wp

    vvv_success " * WP CLI Nightly Installed"

    vvv_info " * Grabbing WP CLI bash completions"
    # Install bash completions
    mkdir -p /srv/config/wp-cli/
    vvv_info " * Downloading WP CLI bash completions"
    curl -s https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash -o /srv/config/wp-cli/wp-completion.bash
    chown vagrant /srv/config/wp-cli/wp-completion.bash
  else
    chown -R vagrant:www-data /usr/local/bin
    chmod +x /usr/local/bin/wp
    vvv_info " * Updating wp-cli..."
    noroot wp cli update --nightly --yes
    vvv_success " * WP CLI Nightly updated"
  fi

  # ensure WP CLI is owned by the right user and executable
  chown -R vagrant:www-data /usr/local/bin
  chmod +x /usr/local/bin/wp

  if [ "${VVV_DOCKER}" != 1 ]; then
    vvv_info " * Disabling debug mods if present before running wp package installs"
    xdebug_off

    vvv_info " * Updating WP packages"
    noroot wp package update
    vvv_info " * WP package updates completed"
  fi
}
export -f wp_cli_setup

vvv_add_hook tools_setup wp_cli_setup<commit_msg>better WP CLI logging<commit_after>#!/usr/bin/env bash
# @description WP CLI
set -eo pipefail

function wp_cli_setup() {
  vvv_info " * [WP CLI]: Installing/updating WP CLI"

  # Remove old wp-cli symlink, if it exists.
  if [[ -L "/usr/local/bin/wp" ]]; then
    vvv_info " * [WP CLI]: Removing old WP CLI symlink"
    rm -f /usr/local/bin/wp
  fi

  if [[ ! -f "/usr/local/bin/wp" ]]; then
    vvv_info " * [WP CLI]: Downloading WP CLI nightly, see <url>http://wp-cli.org</url>"
    noroot curl -sO https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar /tmp/wp-cli-nightly.phar
    chown -R vagrant:www-data /usr/local/bin
    noroot mv -f /tmp/wp-cli-nightly.phar /usr/local/bin/wp
    chmod +x /usr/local/bin/wp

    vvv_success " * [WP CLI]: WP CLI Nightly Installed"

    vvv_info " * [WP CLI]: Grabbing bash completions"
    # Install bash completions
    mkdir -p /srv/config/wp-cli/
    vvv_info " * [WP CLI]: Downloading bash completions"
    curl -s https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash -o /srv/config/wp-cli/wp-completion.bash
    chown vagrant /srv/config/wp-cli/wp-completion.bash
    vvv_success " * [WP CLI]: Bash completions downloaded"
  else
    vvv_info " * [WP CLI]: Updating WP CLI Nightly"
    chown -R vagrant:www-data /usr/local/bin
    chmod +x /usr/local/bin/wp
    noroot wp cli update --nightly --yes
    vvv_success " * [WP CLI]: WP CLI Nightly updated"
  fi

  # ensure WP CLI is owned by the right user and executable
  chown -R vagrant:www-data /usr/local/bin
  chmod +x /usr/local/bin/wp

  if [ "${VVV_DOCKER}" != 1 ]; then
    vvv_info " * [WP-CLI]: Disabling debug mods if present before running wp package installs"
    xdebug_off

    vvv_info " * [WP-CLI]: Updating packages"
    noroot wp package update
    vvv_info " * [WP-CLI]: Package updates completed"
  fi

  vvv_success " * [WP-CLI]: WP CLI setup completed"
}
export -f wp_cli_setup

vvv_add_hook tools_setup wp_cli_setup
{'fraction_non_alphanumeric': 0.12608353033884948, 'fraction_numerical': 0.0005253480430785396, 'mean_word_length': 2.8936605316973414, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '650689', 'n_tokens_mistral': 1481, 'n_tokens_neox': 1411, 'n_words': 372}