Add the possibility to filter the get command with the go text/template package #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This provides an easy way to manipulate the data retrieved via the get command:
Print all ports with some details
[port0] state: RUN, type: 3D, PCIC Port: 50010
[port1] state: RUN, type: 3D, PCIC Port: 50011
[port2] state: RUN, type: 2D, PCIC Port: 50012
[port3] state: RUN, type: 2D, PCIC Port: 50013
[port6] state: RUN, type: IMU, PCIC Port: 50016
Modify the state of the ports
Set all ports to
CONF
ovp8xx get --format '{{ $state := "CONF" }}{ "ports": { {{$p := prefix ", "}}{{- range $key, $val := .ports -}}{{ if ne $key "port6" }}{{call $p}}"{{- $key -}}":{"state": "{{ $state }}"}{{end}}{{- end }} } }'
The result looks like this:
This can be directly piped into the
set
command