diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-02-21 19:57:54 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-02-21 20:26:56 +0100 |
commit | 3e18a6df6c5f26bf04b6383e00c8debb1b08b7e6 (patch) | |
tree | b5970e0b2be67eb96e7bcc87b32ef8e698456156 /doc | |
parent | 0bf22672f9686906b93ede251c8eeb66cf396c65 (diff) |
doc: libimagutil: Add kv-split documentation
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/03000-lib-util.md | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/doc/src/03000-lib-util.md b/doc/src/03000-lib-util.md index ade2ac9c..d31eb4f5 100644 --- a/doc/src/03000-lib-util.md +++ b/doc/src/03000-lib-util.md @@ -9,11 +9,23 @@ used by all other libraries and/or binaries. It is explicitely not intended for module-use only, but for all other libraries. -## Datatypes {#sec:libutil:datatypes} +## Key-Value split {#sec:libutil:kvsplit} -_Nothing here yet_ +This helper implements functionality to split key-value string into two parts. +It was introduced to simplify commandline specification for header fields (see +@lst:kvsplit:headerspec). + +```{#lst:kvsplit:headerspec .bash .numberLines caption="Headerfield spec"} +imag store create --path /some.entry entry --header field=foo +# ^^^^^^^^^ +``` + +It is implemented by introducing a `KeyValue` type which is generic over Key +and Value. This type gets implemented `KeyValue<String, String> for String` to +be able to split a `String` into two `String` objects, key and value +respectively. The implementation is realized via Regex. + +The `KeyValue` type implementes `Into<(K, V)>` for convenience. -## Functions {#sec:libutil:functions} -_Nothing here yet_ |