Skip to content

Commit a3b0172

Browse files
committed
List functions in FuncMap and README.md alphabetically
1 parent ce21a5f commit a3b0172

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Within those templates, the object emitted by docker-gen will have [this structu
108108
* *`closest $array $value`: Returns the longest matching substring in `$array` that matches `$value`
109109
* *`coalesce ...`*: Returns the first non-nil argument.
110110
* *`contains $map $key`*: Returns `true` if `$map` contains `$key`. Takes maps from `string` to `string`.
111+
* *`dict $key $value ...`*: Creates a map from a list of pairs. Each `$key` value must be a `string`, but the `$value` can be any type (or `nil`). Useful for passing more than one value as a pipeline context to subtemplates.
111112
* *`dir $path`: Returns an array of filenames in the specified `$path`.
112113
* *`exists $path`*: Returns `true` if `$path` refers to an existing file or directory. Takes a string.
113114
* *`first $array`*: Returns the first value of an array or nil if the arry is nil or empty.
@@ -116,12 +117,11 @@ Within those templates, the object emitted by docker-gen will have [this structu
116117
* *`groupByMulti $containers $fieldPath $sep`*: Like `groupBy`, but the string value specified by `$fieldPath` is first split by `$sep` into a list of strings. A container whose `$fieldPath` value contains a list of strings will show up in the map output under each of those strings.
117118
* *`hasPrefix $prefix $string`*: Returns whether `$prefix` is a prefix of `$string`.
118119
* *`hasSuffix $suffix $string`*: Returns whether `$suffix` is a suffix of `$string`.
119-
* *`split $string $sep`*: Splits `$string` into a slice of substrings delimited by `$sep`. Alias for [`strings.Split`](http://golang.org/pkg/strings/#Split)
120-
* *`replace $string $old $new $count`*: Replaces up to `$count` occurences of `$old` with `$new` in `$string`. Alias for [`strings.Replace`](http://golang.org/pkg/strings/#Replace)
121-
* *`dict $key $value ...`*: Creates a map from a list of pairs. Each `$key` value must be a `string`, but the `$value` can be any type (or `nil`). Useful for passing more than one value as a pipeline context to subtemplates.
122-
* *`sha1 $string`*: Returns the hexadecimal representation of the SHA1 hash of `$string`.
123120
* *`json $value`*: Returns the JSON representation of `$value` as a `string`.
124121
* *`last $array`*: Returns the last value of an array.
122+
* *`replace $string $old $new $count`*: Replaces up to `$count` occurences of `$old` with `$new` in `$string`. Alias for [`strings.Replace`](http://golang.org/pkg/strings/#Replace)
123+
* *`sha1 $string`*: Returns the hexadecimal representation of the SHA1 hash of `$string`.
124+
* *`split $string $sep`*: Splits `$string` into a slice of substrings delimited by `$sep`. Alias for [`strings.Split`](http://golang.org/pkg/strings/#Split)
125125

126126
===
127127

template.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,20 @@ func generateFile(config Config, containers Context) bool {
175175
"closest": arrayClosest,
176176
"coalesce": coalesce,
177177
"contains": contains,
178+
"dict": dict,
179+
"dir": dirList,
178180
"exists": exists,
179181
"first": arrayFirst,
180182
"groupBy": groupBy,
181-
"groupByMulti": groupByMulti,
182183
"groupByKeys": groupByKeys,
184+
"groupByMulti": groupByMulti,
183185
"hasPrefix": hasPrefix,
184186
"hasSuffix": hasSuffix,
185-
"split": strings.Split,
186-
"replace": strings.Replace,
187-
"dict": dict,
188-
"sha1": hashSha1,
189187
"json": marshalJson,
190188
"last": arrayLast,
191-
"dir": dirList,
189+
"replace": strings.Replace,
190+
"sha1": hashSha1,
191+
"split": strings.Split,
192192
}).ParseFiles(templatePath)
193193
if err != nil {
194194
log.Fatalf("unable to parse template: %s", err)

0 commit comments

Comments
 (0)