Skip to content

Latest commit

 

History

History
100 lines (62 loc) · 3.62 KB

examples-yaml.md

File metadata and controls

100 lines (62 loc) · 3.62 KB

🚀 Examples with YAML

Preview

importer preview command gives you a quick look at how the file may change when importer update and importer purge are run against the provided file. This is meant to be useful for testing and debugging.

$ importer preview ./testdata/yaml/demo-before.yaml
---------------------------------------
Content Before:
1:      title: Demo of YAML Importer
2:      # == imptr: description / begin from: ./snippet-description.yaml#[for-demo] ==
3:      dummy: This will be replaced
4:      # == imptr: description / end ==
---------------------------------------

---------------------------------------
Content After Purged:
1:      title: Demo of YAML Importer
2:      # == imptr: description / begin from: ./snippet-description.yaml#[for-demo] ==
3:      # == imptr: description / end ==
---------------------------------------

---------------------------------------
Content After Processed:
1:      title: Demo of YAML Importer
2:      # == imptr: description / begin from: ./snippet-description.yaml#[for-demo] ==
3:      description: |
4:        This demonstrates how importing YAML snippet is made possible, without
5:        changing YAML handling at all.
6:      # == imptr: description / end ==
---------------------------------------

You can replace the file content with either of the commands below:

  importer update ./testdata/yaml/demo-before.yaml     Replace the file content with the Importer processed file.
  importer purge ./testdata/yaml/demo-before.yaml      Replace the file content by removing all data between marker pairs.

You can find more with 'importer help'

Preview in Action

importer-preview-yaml-demo.mp4

Update

importer update imports based on Importer Markers in the given file, and update the file in place. This is useful for having a single file to manage and also import other file contents. If you want to have a template file which only holds Importer Markers and not actually the imported content, you should use importer generate instead.

Update in Action

importer-update-yaml-demo.mp4

Purge

importer purge removes any lines between Importer Markers in the given file, and update the file in place. The same operation is executed for importer update before importing all the lines, but this "purge" is sometimes useful to see the file without extra data imported.

Purge in Action

importer-purge-yaml-demo.mp4

Generate

importer generate imports based on Importer Markers in the given file, and write the result to stdout or file. This can be used for debugging, or create a template file with Importer Markers but keep the file purely for Importer Markers.

Generate in Action

importer-generate-yaml-demo.mp4