1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
Test the update method of a content.
The test create a content with four features:
- text
- integer
- mono reference
- multi references
and each test start with a new content empty.
$ tests --update --help
Start the tests
--text <v> Set field with the value <v>
--integer <n> Set field with the value <n>
--reference <id> Set field with the id
--references <id,..> Set this list of values
--commit Commit this group of update
--clear <f> Clear the field <f>
-help Display this list of options
--help Display this list of options
After each invocation (or after a commit), the test displays the values for the
content. By default it is empty:
$ tests --update \
> --commit
{"reference":null,"integer":null,"text":null}
The multivaluated field references is not displayed when there is no values.
Any feature can be set using an argument with the same name:
$ tests --update \
> --integer 123
{"reference":null,"integer":123,"text":null}
$ tests --update \
> --text abc
{"reference":null,"integer":null,"text":"abc"}
$ tests --update \
> --reference 1
{"reference":1,"integer":null,"text":null}
The multireferences values are displayed only when they are set.
$ tests --update \
> --references 1,2,3 \
{"reference":null,"integer":null,"text":null}
{"references":1}
{"references":2}
{"references":3}
The "commit" argument can be used to update the content at a given state
$ tests --update \
> --integer 123 \
> --text abc \
> --references 1 \
> --commit \
> --reference 1
{"reference":null,"integer":123,"text":"abc"}
{"references":1}
{"reference":1,"integer":123,"text":"abc"}
{"references":1}
A field can be explicitally set empty. There is a difference between not
updating a field (changing nothing) and setting the field to empty:
$ tests --update \
> --integer 123 \
> --text abc \
> --commit \
> --clear integer
{"reference":null,"integer":123,"text":"abc"}
{"reference":null,"integer":null,"text":"abc"}
$ tests --update \
> --references 1,2,3 \
> --commit \
> --clear references
{"reference":null,"integer":null,"text":null}
{"references":1}
{"references":2}
{"references":3}
{"reference":null,"integer":null,"text":null}
There is no duplicates values in the external references, a new update replace
the existing values.
$ tests --update \
> --references 1,2 \
> --commit \
> --references 1,3
{"reference":null,"integer":null,"text":null}
{"references":1}
{"references":2}
{"reference":null,"integer":null,"text":null}
{"references":1}
{"references":3}
|