Skip to content

Commit 97b5133

Browse files
committed
Updated documentation
1 parent 1e214bc commit 97b5133

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

docs/features.rst

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,72 @@ Append a ``+`` sign to the attribute name to add given value::
9292
/download:
9393
time+: 3
9494

95-
This operation is possible only for attributes of the same type.
96-
Exception ``MergeError`` is raised if types are different. When
95+
This operation is possible only for attributes of the same type
96+
or when merging a dictionary with a list.
97+
Exception ``MergeError`` is raised if types are not compatible. When
9798
the ``+`` suffix is applied on dictionaries ``update()`` method is
9899
used to merge content of given dictionary instead of replacing it.
99100

101+
Example: Merging dictionary with a list::
102+
103+
discover:
104+
how: fmf
105+
filter: "tier:1"
106+
107+
/path:
108+
discover+:
109+
- name: upstream
110+
url: https://some.url
111+
- name: downstream
112+
url: https://other.url
113+
114+
results in::
115+
116+
/path:
117+
discover:
118+
- name: upstream
119+
url: https://some.url
120+
how: fmf
121+
filter: "tier:1"
122+
- name: downstream
123+
url: https://other.url
124+
how: fmf
125+
filter: "tier:1"
126+
127+
Example: Merging list with a dictionary::
128+
129+
discover:
130+
- how: fmf
131+
url: https://github.com/project1
132+
- how: fmf
133+
url: https://github.com/project2
134+
135+
/tier1:
136+
discover+:
137+
filter: "tier:1"
138+
/tier2:
139+
discover+:
140+
filter: "tier:2"
141+
142+
results in::
143+
144+
/tier1:
145+
discover:
146+
- how: fmf
147+
url: https://github.com/project1
148+
filter: "tier:1"
149+
- how: fmf
150+
url: https://github.com/project2
151+
filter: "tier:1"
152+
/tier2:
153+
discover:
154+
- how: fmf
155+
url: https://github.com/project1
156+
filter: "tier:2"
157+
- how: fmf
158+
url: https://github.com/project2
159+
filter: "tier:2"
160+
100161
The special suffix ``+<`` can be used to prepend values instead of
101162
appending them. This might be handy when adjusting lists::
102163

0 commit comments

Comments
 (0)