Sha256: 6f9b5fb35093c7b9e277606b8f7a816d7c5b42e9e9a731170baddf69cc03066c
Contents?: true
Size: 1.47 KB
Versions: 6
Compression:
Stored size: 1.47 KB
Contents
#!/bin/bash # ./test.sh OPTIONS PATH # test.sh -h for options OPTIND=1 show_help() { echo "$(basename $0): Shortcut for testing conductor with a given file" echo "Options:" echo " -p [pre|pro] (run as preprocessor(*) or processor)" echo " -o [err|out] (output stderr, stdout, both(*))" echo " -d (debug, only show stderr)" echo "Usage:" echo " $0 [-p PHASE] [-o OUTPUT] FILE_PATH" } if [[ -f bin/conductor ]]; then CMD="./bin/conductor" else CMD="$(which conductor)" fi PHASE="PREPROCESS" STD="BOTH" while getopts "h?p:o:d" opt; do case "$opt" in h|\?) show_help exit 0 ;; p) PHASE=$OPTARG ;; o) STD=$OPTARG ;; d) STD="ERR" ;; esac done shift $((OPTIND-1)) [ "${1:-}" = "--" ] && shift if [[ -z $1 ]]; then show_help exit 1 fi FILE=$(realpath $1) FILENAME=$(basename -- "$FILE") EXTENSION="${FILENAME##*.}" PHASE=$(echo $PHASE | tr [a-z] [A-Z]) STD=$(echo $STD | tr [a-z] [A-Z]) if [[ $PHASE =~ ^PRE ]]; then PHASE="PREPROCESS" else PHASE="PROCESS" fi export OUTLINE="NONE" export MARKED_ORIGIN="$FILE" export MARKED_EXT="$EXTENSION" export MARKED_CSS_PATH="/Applications/Marked 2.app/Contents/Resources/swiss.css" export PATH="$PATH:$(dirname "$FILE")" export MARKED_PATH="$FILE" export MARKED_INCLUDES="" export MARKED_PHASE="$PHASE" if [[ $STD =~ ^(STD)?E ]]; then command cat "$FILE" | $CMD 1>/dev/null elif [[ $STD =~ ^(STD)?O ]]; then command cat "$FILE" | $CMD 2>/dev/null else command cat "$FILE" | $CMD fi
Version data entries
6 entries across 6 versions & 1 rubygems