forked from ucdavisdatalab/Spatial_SQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknit.R
More file actions
28 lines (24 loc) · 667 Bytes
/
knit.R
File metadata and controls
28 lines (24 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env Rscript
show_help = function() {
# ' Show a help message
cat("Render a workshop reader website with Bookdown.\nArguments:\n")
cat("[-h | --help]\t Show this help message\n")
cat("[-p | --pdf]\t Include to render a PDF while building site\n")
quit()
}
main = function(args) {
# ' Run the script
if ("-h" %in% args || "--help" %in% args) {
show_help()
}
if ("-p" %in% args || "--pdf" %in% args) {
bookdown::render_book(
"index.Rmd", output_format = "pdf_document", output_file = "docs/_main"
)
}
bookdown::render_book("index.Rmd")
}
if (!interactive()) {
args = commandArgs(trailingOnly=TRUE)
main(args)
}