Skip to content

Commit

Permalink
Docs, bump version.
Browse files Browse the repository at this point in the history
  • Loading branch information
DirtyHairy committed Oct 1, 2018
1 parent 37cae94 commit d371240
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ Initial release
## 0.3.1

* Fix recursion in `docker-ls repositories`and `docker-ls tags`

## 0.3.2

* Support golang templates for formatting output
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ This list is not exhaustive; please consult the command line (`-h`) help for all
for recursive output. Depths 0 (default) and 1 are supported. Please note
the recursing means more API requests and may be slow.
* `--json (-j)` Switch output format from YAML to JSON.
* `--template (-t)` Use a named golang template from the configuration for output (see below)
* `--template-source` Use the specified template for output (see below)
* `--basic-auth` Use HTTP basic auth for authentication (instead of token authentication).
* `--allow-insecure` Do not validate SSL certificates (useful for registries secured with a
self-signed certificate).
Expand Down Expand Up @@ -218,6 +220,56 @@ registry URL and username

Other config files can be specified via the `--config` option.

### Template Output

Output of the various `docker-ls` subcommands can be further customized by using
[golang templates](https://golang.org/pkg/text/template/).

#### Predefined templates

Named templates can be configured in the `templates` section of the configuration file.
When `docker-ls` is invoked, the `-t` parameter (see above) can be used to select a named
template for formatting the output.

**Example:** The following YAML section defines a template that outputs the list of tags
in a repository as a simple HTML document.

```
templates:
taglist_html: |
<head></head>
<body>
<h1>Tags for repository {{ html .Repository }}</h1>
<ul>
{{- range .Tags }}
<li>{{ html . }}</li>
{{- end }}
</ul>
</body>
```

It can be invoked by running i.e.

```
docker-ls tags -t taglist_html /library/debian
```

#### Inline templates

Simple templates can also be passed directly on the command line using the `--template-source`
parameter:

```
docker-ls tag --template-source '{{ .TagName }}: {{ .Digest }}' /library/debian:wheezy
```

### Template variables

Inside templates, all fields of the corresponding JSON / YAML output can be accessed in pipeline
expressions. The first letter of all field names is capitalized, with the exception of manifests
that are directly returned from the registry by using `docker-ls tag --raw-manifest`: for
those, the JSON / YAML field names are unchanged.

### Environment variables

In addition to config files and CLI flags, environment variables can be used to specify options
Expand Down
2 changes: 1 addition & 1 deletion generators/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

const (
STATIC_VERSION = "0.3.1"
STATIC_VERSION = "0.3.2"
TEMPLATE = `// THIS FILE WAS AUTOGENERATED BY GO GENEREATE. DO NOT EDIT!
package %s
Expand Down

0 comments on commit d371240

Please sign in to comment.