Sha256: c39cd934857692d9921e059f919ff0d29f21f9c97c126688a96b2182a551776b

Contents?: true

Size: 997 Bytes

Versions: 1

Compression:

Stored size: 997 Bytes

Contents

#!/bin/bash

if [[ "${BASH_SOURCE##*/}" = "_sub" ]]; then
function sub {
  local bsource="$1"; shift
  local sub_base="$(basename "$bsource")"
  local bsource_cmd="$shome/libexec/${sub_base}"

  if [[ "$bsource_cmd" = "$bsource" ]]; then
    FLAGS_SUB="$FLAGS_TRUE"
    export _SUB_ARGS="$@"
    parse_command_line "$@" || exit $?
    eval set -- "${FLAGS_ARGV}"
  fi

  if [[ "$#" > 0 ]]; then
    if [[ ! "$1" =~ ^- ]]; then
      local sub_cmd="$(command -v "${sub_base}-$1" || true)"
      if [[ ! -x "$sub_cmd" ]]; then
        sub_cmd="$shome/libexec/${sub_base}-$1"
      fi

      if [[ -x "$sub_cmd" ]]; then
        shift
        exec "$sub_cmd" "$@"
      fi
    fi
  fi

  if [[ -x "$bsource_cmd" && "$bsource_cmd" != "$bsource" ]]; then
    exec "$bsource_cmd" "$@"
  else
    main "$@"
  fi
}

  if [[ "$#" > 0 ]]; then
    sub "$@"  
  fi
else
  shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
  source "$shome/libexec/_jason"
  require 'sub' "$BASH_SOURCE" "$@"
fi

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alpha_omega-1.5.12 libexec/_sub