Skip to content

Commit 3c5d1ab

Browse files
committed
force-report outputs csv
1 parent cad30c7 commit 3c5d1ab

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

bash/force-level2-report.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ while :; do
7474
-h|--help) help ;;
7575
-v|--version) force_version; exit 0;;
7676
-i|--info) echo "Generate Level 2 processing report"; exit 0;;
77-
-o|--output) OUTPUT="$2"; shift ;;
77+
-o|--output) OUTREPORT="$2"; shift ;;
7878
-- ) shift; break ;;
7979
* ) break ;;
8080
esac
@@ -97,18 +97,29 @@ if [ ! -d $LOGDIR ]; then
9797
echoerr "$LOGDIR does not exist."; help
9898
fi
9999

100-
if [ -z "$OUTPUT" ]; then
100+
if [ -z "$OUTREPORT" ]; then
101101
if [ ! -w $LOGDIR ]; then
102102
echoerr "$LOGDIR is not writeable."; help
103103
fi
104104
TIME=$(date +"%Y%m%d-%H%M%S")
105-
OUTPUT="$LOGDIR/FORCE_L2PS_$TIME.html"
105+
OUTREPORT="$LOGDIR/FORCE_L2PS_$TIME.html"
106106
fi
107-
export OUTPUT=$(readlink -f $OUTPUT) # absolute directory path
108-
export OUTDIR=`dirname $OUTPUT`;
107+
108+
if [[ $OUTREPORT != *.html ]]; then
109+
echoerr "$OUTREPORT extension must be .html"; help
110+
fi
111+
OUTREPORT=$(readlink -f "$OUTREPORT") # absolute directory path
112+
export OUTREPORT
113+
114+
OUTTABLE="${OUTREPORT%.*}.csv"
115+
export OUTTABLE
116+
117+
OUTDIR=$(dirname "$OUTREPORT")
118+
export
119+
109120

110121
debug "binary directory: $BIN"
111122
debug "log directory: $LOGDIR"
112-
debug "output: $OUTPUT"
123+
debug "output: $OUTREPORT"
113124

114-
$REPORT_EXE -e "rmarkdown::render('$REPORT_TEMPLATE', output_file = '$OUTPUT', intermediates_dir = '$OUTDIR', params = list(dlog = '$LOGDIR'))"
125+
$REPORT_EXE -e "rmarkdown::render('$REPORT_TEMPLATE', output_file = '$OUTREPORT', intermediates_dir = '$OUTDIR', params = list(dlog = '$LOGDIR', ftable = '$OUTTABLE'))"

misc/force-level2-report.Rmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ date: "`r Sys.Date()`"
44
output: html_document
55
params:
66
dlog: "log"
7+
ftable: NULL
78
---
89

910
```{r load-packages, include = FALSE}
@@ -466,3 +467,7 @@ fig <- plot_ly(data = data,
466467
fig
467468
```
468469

470+
```{r write-csv, echo = FALSE, warning = FALSE}
471+
write.csv(data, file = ftable)
472+
```
473+

misc/force-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.12-dev:::2024-07-19_12:05:02
1+
3.7.12-dev:::2024-07-22_06:46:13

0 commit comments

Comments
 (0)