<commit_before>#!/bin/bash
##  Show port list of all running container. Show exposed ports or mapped depends
##  of seletec option.
##  
##  Usage:
##     @script.name [option]
##  
##  Options:
##     -h, --help                     print this documentation
##  
##         --exposed                  index of the container name
##  
##  Parameters (edjanger.properties):
##     container_name                 container name
##     docker_command                 show docker command when edjanger is used
##     ps_options                    \"docker ps\" options to a running container
##  
##  edjanger, The MIT License (MIT)
##  Copyright (c) 2016 copyright <EMAIL>
##  
# ------------------------------------------------------------------------------
source {edjangerpath}/_common.sh

ports=
if [[ "$1" =~ ^[-]*h[a-z]* ]] || [ "$1" = "-h" ]; then
  printHeader $0
else
  # list all container
  containers=$(docker ps --filter "status=running" -aq)
  if [ "$1" != *"exposed"* ]; then
    echo -e "--- List all mapped ports on runnning containers..."
  else
    echo -e "--- List all exposed ports on runnning containers..."
  fi
  for c in ${containers}; do
    id=$(docker ps --format "Id:{{.ID}} Image:{{.Image}} Name:{{.Names}}" |grep $c)
    if [ "$1" != *"exposed"* ]; then
      echo -e "$id"
      docker port $c
     else
       ports+=$(printf "%s;" $(docker port $c|cut -d ':' -f2))
     fi
  done
  if [ "$1" == *"exposed"* ]; then
    echo -e "${ports%;;}"
  fi
fi
<commit_msg>correction of exposed port + add all, replace exposed by list<commit_after>#!/bin/bash
##  Print ports list of all running container.
##  
##  Usage:
##     @script.name [option]
##  
##  Options:
##     -h, --help                     print this documentation
##  
##         --list                     print list of exposed ports for all running containers
##  
##  Parameters (edjanger.properties):
##     container_name                 container name
##     docker_command                 show docker command when edjanger is used
##     ps_options                    \"docker ps\" options to a running container
##  
##  edjanger, The MIT License (MIT)
##  Copyright (c) 2016 copyright <EMAIL>
##  
# ------------------------------------------------------------------------------
source {edjangerpath}/_common.sh

ports=
if [[ "$1" =~ ^[-]*h[a-z]* ]] || [ "$1" = "-h" ]; then
  printHeader $0
else
  # list all container
  containers=$(docker ps --filter "status=running" -aq)
  if [[ "$1" == *"list"* ]]; then
    echo -e "--- List all exposed ports on runnning containers..."
  elif [[ "$1" == *"all"* ]]; then
    echo -e "--- List all exposed ports on all containers..."
  else
    echo -e "--- List all mapped ports on runnning containers..."
  fi
  for c in ${containers}; do
    id=$(docker ps --format "Id:{{.ID}} Image:{{.Image}} Name:{{.Names}}" |grep $c)
    if [[ "$1" == *"list"* ]]; then
      ports+=$(printf "%s;" $(docker port $c|cut -d ':' -f2))
    elif [[ "$1" == *"all"* ]]; then
      publishall=$(docker inspect --format='{{json .HostConfig.PublishAllPorts }}' $c)
      portbinding=$(docker inspect --format='{{json .HostConfig.PortBindings }}' $c)
      portexposed=$(docker inspect --format='{{json .Config.ExposedPorts }}' $c)
      netports=$(docker inspect --format='{{json .NetworkSettings.Ports }}' $c)
      printf "container $c: publish-all-ports=$publishall; bind=$portbinding; exposed=$portexposed; networking=$netports\n"
    else
      echo -e "$id"
      docker port $c
     fi
  done
  if [[ "$1" == *"list"* ]]; then
    echo -e "${ports%;;}"
  fi
fi

{'fraction_non_alphanumeric': 0.21243378868134932, 'fraction_numerical': 0.006690827989963758, 'mean_word_length': 2.095772217428818, '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': '5127576', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1074, 'n_words': 346}