Skip to contents

Export justification as YAML

Usage

export_justification(
  x,
  file = NULL,
  encoding = "UTF-8",
  append = TRUE,
  preventOverwriting = TRUE,
  silent = justifier::opts$get("silent")
)

Arguments

x

The justification, either loaded from one or more files or programmatically constructed. This can be one or more decisions, justifications, assertions, or sources.

file

If specified, the file to export the justification to.

encoding

The encoding to use when writing the file.

append

Whether to append to the file, or replace its contents.

preventOverwriting

Whether to prevent overwriting an existing file.

silent

Whether to be silent or chatty.

Value

The generated YAML, invisibly, unless file is NULL.

Examples

### Programmatically create a simple justification object
justifierObject <-
  justifier::asrt(
    "assertion",
    source = c(
      justifier::srce('source1'),
      justifier::srce('source2')));

### Export to YAML
justifierYAML <-
  justifier::export_justification(
    justifierObject,
    file=NULL);

### Show YAML
cat(justifierYAML, sep="\n");
#> ---
#> assertion:
#>   id: dcio_A7n8bp9nt
#>   label: assertion
#>   description: ''
#>   type: ''
#>   source:
#>   - id: sbjw_S7n8bp9nt
#>     label: source1
#>     description: ''
#>     xdoi: ''
#>     type: ''
#>   - id: cdhe_S7n8bp9nt
#>     label: source2
#>     description: ''
#>     xdoi: ''
#>     type: ''
#>   
#> ---
#>