Skip to content

Commit

Permalink
'config cat' output in toml format
Browse files Browse the repository at this point in the history
  • Loading branch information
penguwin committed Sep 18, 2020
1 parent 4221775 commit c33d6c7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/knoxite/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
package main

import (
"encoding/json"
"bytes"
"fmt"
"log"
"strconv"
"strings"

"github.com/BurntSushi/toml"
"github.com/knoxite/knoxite/cmd/knoxite/config"
"github.com/muesli/gotable"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -182,12 +183,12 @@ func executeConfigInfo() error {
}

func executeConfigCat() error {
json, err := json.MarshalIndent(cfg, "", " ")
if err != nil {
buf := new(bytes.Buffer)
if err := toml.NewEncoder(buf).Encode(cfg); err != nil {
return err
}

fmt.Printf("%s\n", json)
fmt.Printf("%s\n", buf)
return nil
}

Expand Down

0 comments on commit c33d6c7

Please sign in to comment.