claptrap 0.3.0

Bring the power of Clap to shell scripts.
Documentation
---
source: tests/script.rs
expression: "String::from_utf8_lossy(&output.stdout)"
---
#!/usr/bin/env bash

set -euo pipefail

if ! command -v claptrap &> /dev/null; then
    echo "claptrap command not found. Please install it first, see https://claptrap.sh for instructions."
    exit 1
fi

eval "$(claptrap --spec tests/resources/script/bash/spec.toml -- "$@")"

if [ -z "${claptrap__subcommand+x}" ]; then
  if [ -n "${claptrap_arg1+x}" ]; then
    echo "claptrap_arg1: ${claptrap_arg1}"
  fi
  if [ -n "${claptrap_multi1+x}" ]; then
    for i in "${!claptrap_multi1[@]}"; do
      echo "claptrap_multi1[$i]: ${claptrap_multi1[$i]}"
    done
  fi
else
  echo "claptrap__subcommand: ${claptrap__subcommand}"
  case "${claptrap__subcommand}" in
    "first")
      if [ -n "${claptrap_first_arg2+x}" ]; then
        echo "claptrap_first_arg2: ${claptrap_first_arg2}"
      fi
      if [ -n "${claptrap_first_multi2+x}" ]; then
        for i in "${!claptrap_first_multi2[@]}"; do
          echo "claptrap_first_multi2[$i]: ${claptrap_first_multi2[$i]}"
        done
      fi
      ;;
    "another")
      if [ -n "${claptrap_another_arg4+x}" ]; then
        echo "claptrap_another_arg4: ${claptrap_another_arg4}"
      fi
      if [ -n "${claptrap_another_multi4+x}" ]; then
        for i in "${!claptrap_another_multi4[@]}"; do
          echo "claptrap_another_multi4[$i]: ${claptrap_another_multi4[$i]}"
        done
      fi
      ;;
    "first::nested")
      if [ -n "${claptrap_first_nested_arg3+x}" ]; then
        echo "claptrap_first_nested_arg3: ${claptrap_first_nested_arg3}"
      fi
      if [ -n "${claptrap_first_nested_multi3+x}" ]; then
        for i in "${!claptrap_first_nested_multi3[@]}"; do
          echo "claptrap_first_nested_multi3[$i]: ${claptrap_first_nested_multi3[$i]}"
        done
      fi
      ;;
  esac
fi