Elektra  0.8.26
Plugin: yaypeg

YAy PEG

The YAy PEG plugin use a parser based on PEGTL to convert YAML data to Elektra’s KeySet type.

Dependencies

This plugin requires https://github.com/taocpp/PEGTL/blob/2.7.x/doc/Installing-and-Using.md "PEGTL" 2.7.1. Previous versions of the library might work too. However, neither the current development version of PEGTL (3.0), nor the latest version of PEGTL 2.7.x can be used by the plugin because of the issue referenced here.

Examples

Mappings

```

Mount plugin

sudo kdb mount config.yaml user/tests/yaypeg yaypeg

Add some values

kdb set user/tests/yaypeg/movements/deadly 'Dull' kdb set user/tests/yaypeg/movements/deep 'Red'

Manually add a key

printf 'Rosalía: El::Mal::Querer' >> kdb file user/tests/yaypeg

List keys

kdb ls user/tests/yaypeg #> user/tests/yaypeg/Rosalía #> user/tests/yaypeg/movements/deadly #> user/tests/yaypeg/movements/deep

Retrieve a value

kdb get user/tests/yaypeg/Rosalía #> El::Mal::Querer

Undo modifications

kdb rm -r user/tests/yaypeg sudo kdb umount user/tests/yaypeg

### Arrays

Mount plugin

sudo kdb mount config.yaml user/tests/yaypeg yaypeg

Manually add some values

printf 'ponies:
' > kdb file user/tests/yaypeg printf ' - Flutter Shy # Yay!
' >> kdb file user/tests/yaypeg printf ' - Pinkie Pie
' >> kdb file user/tests/yaypeg printf ' - Maud Pie' >> kdb file user/tests/yaypeg

List array keys

kdb ls user/tests/yaypeg #> user/tests/yaypeg/ponies #> user/tests/yaypeg/ponies/#0 #> user/tests/yaypeg/ponies/#1 #> user/tests/yaypeg/ponies/#2

Retrieve last array entry

kdb get user/tests/yaypeg/ponies/$(kdb getmeta user/tests/yaypeg/ponies array) #> Maud Pie

Undo modifications

kdb rm -r user/tests/yaypeg sudo kdb umount user/tests/yaypeg ```

Limitations

The plugin has the same limitations as YAMBi .