1
- # ` ZSH-STRING-LIB `
2
-
3
- <!-- START doctoc generated TOC please keep comment here to allow auto update -->
4
- <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
5
-
6
- - [ Introduction] ( #introduction )
7
- - [ List Of The Functions] ( #list-of-the-functions )
8
- - [ @str-parse-json ] ( #str-parse-json )
9
- - [ @str-read-all ] ( #str-read-all )
10
- - [ @str-ng-match ] ( #str-ng-match )
11
- - [ @str-ng-matches ] ( #str-ng-matches )
12
- - [ @str-read-ini ] ( #str-read-ini )
13
- - [ @str-read-toml ] ( #str-read-toml )
14
- - [ @str-dump ] ( #str-dump )
15
-
16
- <!-- END doctoc generated TOC please keep comment here to allow auto update -->
1
+ <h1 > Zsh String Lib </h1 >
17
2
18
3
# Introduction
19
4
@@ -28,37 +13,37 @@ Parses the buffer (`$1`) with JSON and returns:
28
13
1 . Fields for the given key (` $2 ` ) in the given hash (` $3 ` ).
29
14
2 . The hash looks like follows:
30
15
31
- ``` txt
32
- 1/1 → strings at the level 1 of the 1st object
33
- 1/2 → strings at the level 1 of the 2nd object
34
- …
35
- 2/1 → strings at 2nd level of the 1st object
36
- …
37
- ```
16
+ ``` txt
17
+ 1/1 → strings at the level 1 of the 1st object
18
+ 1/2 → strings at the level 1 of the 2nd object
19
+ …
20
+ 2/1 → strings at 2nd level of the 1st object
21
+ …
22
+ ```
38
23
39
- The strings are parseable with `"${(@Q)${(@z)value}"`, i.e.:
40
- they're concatenated and quoted strings found in the JSON.
24
+ The strings are parseable with ` "${(@Q)${(@z)value}" ` , i.e.:
25
+ they're concatenated and quoted strings found in the JSON.
41
26
42
27
Example:
43
28
44
29
``` json
45
30
{
46
- "zplugin-ices":{
47
- "default":{
48
- "wait":"1",
49
- "lucid":"",
50
- "as":"program",
51
- "pick":"fzy",
52
- "make":"",
53
- },
54
- "bgn":{
55
- "wait":"1",
56
- "lucid":"",
57
- "as":"null",
58
- "make":"",
59
- "sbin":"fzy;contrib/fzy-*"
60
- }
31
+ "zplugin-ices" : {
32
+ "default" : {
33
+ "wait" : " 1" ,
34
+ "lucid" : " " ,
35
+ "as" : " program" ,
36
+ "pick" : " fzy" ,
37
+ "make" : " "
38
+ },
39
+ "bgn" : {
40
+ "wait" : " 1" ,
41
+ "lucid" : " " ,
42
+ "as" : " null" ,
43
+ "make" : " " ,
44
+ "sbin" : " fzy;contrib/fzy-*"
61
45
}
46
+ }
62
47
}
63
48
```
64
49
@@ -107,8 +92,7 @@ Arguments:
107
92
Consumes whole data from given file descriptor and stores the string under the
108
93
given (`$2`) parameter, which is `REPLY` by default.
109
94
110
- The reason to create this function is speed – it' s much faster than ` read -d
111
- ' ' ` .
95
+ The reason to create this function is speed – it' s much faster than ` read -d ' ' ` .
112
96
113
97
It can try hard to read the whole data by retrying multiple times (` 10` by
114
98
default) and sleeping before each retry (not done by default).
@@ -159,7 +143,7 @@ strings.
159
143
Input:
160
144
161
145
- ` $1 ` … ` $n -1` - the strings to match in,
162
- - ` $n ` - the pattern to match in the strings.
146
+ - ` $n ` - the pattern to match in the strings.
163
147
164
148
Return value:
165
149
@@ -271,6 +255,4 @@ Output:
271
255
```
272
256
a\ key: a\ value
273
257
key: value
274
- ````
275
-
276
- <!-- vim:set ft=markdown tw=80 fo+=an1 autoindent: -->
258
+ ```
0 commit comments