<commit_before>#!/bin/bash

: "${taito_cli_path:?}"
: "${taito_plugin_path:?}"
: "${taito_namespace:?}"
: "${taito_project:?}"

pod="${1:?}"
container="${2}"
command=("${@:3}")

# Change namespace
"${taito_plugin_path}/util/use-context.sh"

if [[ ${pod} != *"-"* ]]; then
  pod=$(kubectl get pods | grep "${taito_project}" | grep "${pod}" | \
    head -n1 | awk '{print $1;}')
fi

if [[ "${container}" == "--" ]] || [[ "${container}" == "-" ]]; then
  container=$(echo "${pod}" | sed -e 's/\([^0-9]*\)*/\1/;s/-[0-9].*$//')
fi

if [[ -z "${pod}" ]]; then
  echo
  echo "kubectl: Please give pod name as argument:"
  kubectl get pods
else
  # Kubernetes
  echo
  echo "-------------------------------------------------------------------"
  echo
  kubectl exec -it "${pod}" -c "${container}" -- "${command[@]}"
fi<commit_msg>fix: Determine full pod name correctly when project name contains the given pod short name (e.g. server)<commit_after>#!/bin/bash

: "${taito_cli_path:?}"
: "${taito_plugin_path:?}"
: "${taito_namespace:?}"
: "${taito_project:?}"

pod="${1:?}"
container="${2}"
command=("${@:3}")

# Change namespace
"${taito_plugin_path}/util/use-context.sh"

if [[ ${pod} != *"-"* ]]; then
  # Short pod name was given. Determine the full pod name.
  pod=$(kubectl get pods | grep "${taito_project}" | \
    sed -e "s/${taito_project}-//" | \
    grep "${pod}" | \
    head -n1 | awk "{print \"${taito_project}-\" \$1;}")
fi

if [[ "${container}" == "--" ]] || [[ "${container}" == "-" ]]; then
  # No container name was given. Determine container name.
  container=$(echo "${pod}" | sed -e 's/\([^0-9]*\)*/\1/;s/-[0-9].*$//')
fi

if [[ -z "${pod}" ]]; then
  echo
  echo "kubectl: Please give pod name as argument:"
  kubectl get pods
else
  # Kubernetes
  echo
  echo "-------------------------------------------------------------------"
  echo
  kubectl exec -it "${pod}" -c "${container}" -- "${command[@]}"
fi
{'fraction_non_alphanumeric': 0.32014575741801143, 'fraction_numerical': 0.010411244143675169, 'mean_word_length': 2.7176015473887816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6691548', 'n_tokens_mistral': 721, 'n_tokens_neox': 685, 'n_words': 169}