func toPrettyJsonString(obj interface{}) string {
	output, _ := json.MarshalIndent(obj, "", "  ")
	return fmt.Sprintf("%s", output)
}
toPrettyJson encodes an item into a pretty (indented) JSON string
package commands
import (
	"encoding/json"
	"fmt"
	"github.com/gofunct/goexec/pkg/util"
	"github.com/spf13/cobra"
)
var DebugCmd = &cobra.Command{
	Use:   "debug",
	Short: "debug flags or current configuration",
}
var cfgDebug = &cobra.Command{
	Use:   "config",
	Short: "debug configuration settings",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("%s", jsonSettingsString())
	},
}
var flagDebug = &cobra.Command{
	Use:   "flags",
	Short: "debug current flag settings",
	Run: func(cmd *cobra.Command, args []string) {
		cmd.Root().DebugFlags()
	},
}
func init() {
	DebugCmd.AddCommand(cfgDebug, flagDebug)
}
func jsonSettingsString() string {
	return (toPrettyJsonString(util.V.AllSettings()))
}