spin_sh: Spin a bash script into Rmd

Description Usage Arguments Examples

Description

This function is derived from knitr::spin() for R-scripts and is adapted to do a similar conversion of bash scripts into Rmd files. The conversion is done in a simple way and almost no features of the original are provided. This is just a very crude way to have a look at documentation of a shell script in a nicer format such as html. When specified, the generated Rmd is rendered to html using rmarkdown::render().

Usage

1
2
3
4
5
6
7
spin_sh(
  ps_sh_hair,
  ps_out_rmd = paste0(basename(fs::path_ext_remove(ps_sh_hair)), ".Rmd"),
  pb_knit = TRUE,
  pobi_output_format = NULL,
  pb_keep_rmd = FALSE
)

Arguments

ps_sh_hair

path to the bash scirpt

ps_out_rmd

output Rmd file

pb_knit

flag whether generated Rmd should be rendered

pobi_output_format

desired output format passed to rmarkdown::render()

pb_keep_rmd

should Rmd source file be kept

Examples

1
2
3
4
s_test_script <- system.file('extdata', 'test_script.sh', package = 'qgert')
s_test_out <- file.path(tempdir(), 'test_script.Rmd')
spin_sh(ps_sh_hair = s_test_script, ps_out_rmd = s_test_out)
unlink(s_test_out)

pvrqualitasag/qgert documentation built on June 29, 2021, 11:14 p.m.