Skip to content

Commit

Permalink
add PrintObject func
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagleft committed Oct 24, 2024
1 parent bc8125a commit a901953
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions helpers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package swissknife

import (
"encoding/json"
"fmt"
"log"

"github.com/common-nighthawk/go-figure"
"github.com/fatih/color"
Expand All @@ -24,3 +26,12 @@ func PrintIntroMessage(appName, cryptoAddress string, cryptoCoinTag ...string) {
color.Green(cryptoAddress + " " + coinTag)
fmt.Println()
}

func PrintObject(o any) {
data, err := json.MarshalIndent(o, "", " ")
if err != nil {
log.Fatalln(err)
}

fmt.Println(string(data))
}

0 comments on commit a901953

Please sign in to comment.