refactor!: lowercase, hyphenate keys
This will potentially break scripts, so time to discuss!
This commit is contained in:
parent
57692ec3c9
commit
14f2d72aba
|
@ -3,6 +3,7 @@ package jsontable
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/olekukonko/tablewriter"
|
"github.com/olekukonko/tablewriter"
|
||||||
)
|
)
|
||||||
|
@ -109,6 +110,9 @@ func (t *JSONTable) _JSONRenderInner() {
|
||||||
}
|
}
|
||||||
writeChar(t.out, '{')
|
writeChar(t.out, '{')
|
||||||
for keyidx, key := range t.keys {
|
for keyidx, key := range t.keys {
|
||||||
|
key := strings.ToLower(key)
|
||||||
|
key = strings.ReplaceAll(key, " ", "-")
|
||||||
|
|
||||||
value := "nil"
|
value := "nil"
|
||||||
if keyidx < len(row) {
|
if keyidx < len(row) {
|
||||||
value = row[keyidx]
|
value = row[keyidx]
|
||||||
|
@ -138,10 +142,8 @@ func (t *JSONTable) JSONRender() {
|
||||||
|
|
||||||
if t.hasCaption {
|
if t.hasCaption {
|
||||||
fmt.Fprintf(t.out, "\"%s\":\"%s\",", t.captionLabel, t.caption)
|
fmt.Fprintf(t.out, "\"%s\":\"%s\",", t.captionLabel, t.caption)
|
||||||
|
|
||||||
}
|
}
|
||||||
fmt.Fprintf(t.out, "\"%s\":", t.dataLabel)
|
fmt.Fprintf(t.out, "\"%s\":", t.dataLabel)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// write list
|
// write list
|
||||||
|
|
|
@ -325,6 +325,22 @@ setup(){
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "ls: show secrets as machine readable" {
|
||||||
|
run $ABRA app secret ls "$TEST_APP_DOMAIN"
|
||||||
|
assert_success
|
||||||
|
assert_output --partial 'false'
|
||||||
|
|
||||||
|
run $ABRA app secret generate "$TEST_APP_DOMAIN" --all
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run $ABRA app secret ls "$TEST_APP_DOMAIN" --machine
|
||||||
|
assert_success
|
||||||
|
assert_output --partial '"created-on-server":"true"'
|
||||||
|
|
||||||
|
run $ABRA app secret rm "$TEST_APP_DOMAIN" --all
|
||||||
|
assert_success
|
||||||
|
}
|
||||||
|
|
||||||
@test "ls: bail if unstaged changes and no --chaos" {
|
@test "ls: bail if unstaged changes and no --chaos" {
|
||||||
run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
Loading…
Reference in New Issue