
run_mlr() {
  echo
  echo ................................................................
  echo mlr "$@"
  ./mlr "$@"
}

run_mlr_for_auxents() {
  echo
  echo ................................................................
  echo mlr "$@"
  ./mlr "$@"
}

run_cat() {
  echo cat "$@"
  echo cat "$@" >> $outfile
  cat "$@" >> $outfile
  echo >> $outfile
}

mlr_expect_fail() {
  echo
  echo ................................................................
  echo mlr "$@"
  mlr "$@"
  status=$?
  if [ $status -ne 1 ]; then
    echo "Exit status was $status; expected 1."
  fi
}

announce() {
	echo
	echo "================================================================"
	echo "$@"
	echo
}

mention() {
	echo
	echo ---------------------------------------------------------------- "$@"
}

# ================================================================
flags="-a"

# ================================================================
#vee=-v
vee=

# ----------------------------------------------------------------
# It's annoying trying to check in text files (especially CSV) with CRLF
# to Git, given that it likes to 'fix' line endings for multi-platform use.
# It's easy to simply create CRLF on the fly.
run_mlr_for_auxents termcvt --lf2crlf < $indir/comments/comments1.json > $outdir/comments1-crlf.json

echo "AAA"
ls -l $indir/comments/comments1.json
ls -l $outdir/comments1-crlf.json
hex $outdir/comments1-crlf.json

mention input comments1-crlf.json
run_cat $outdir/comments1-crlf.json

echo "BBB"
ls -l $outdir/comments1-crlf.json
hex $outdir/comments1-crlf.json

mention skip comments1-crlf.json
run_mlr --skip-comments --ijson --odkvp cat < $outdir/comments1-crlf.json
echo "CCC"
ls -l $outdir/comments1-crlf.json
hex $outdir/comments1-crlf.json
run_mlr --skip-comments --ijson --odkvp cat   $outdir/comments1-crlf.json
echo "DDD"
ls -l $outdir/comments1-crlf.json
hex $outdir/comments1-crlf.json

mention pass comments1-crlf.json
run_mlr --pass-comments --ijson --odkvp cat < $outdir/comments1-crlf.json
echo "EEE"
ls -l $outdir/comments1-crlf.json
hex $outdir/comments1-crlf.json
run_mlr --pass-comments --ijson --odkvp cat   $outdir/comments1-crlf.json
echo "FFF"
ls -l $outdir/comments1-crlf.json
hex $outdir/comments1-crlf.json
