github.com/orteth01/up@v0.2.0/internal/cli/config/config.go (about) 1 package open 2 3 import ( 4 "encoding/json" 5 "os" 6 7 "github.com/apex/up/internal/cli/root" 8 "github.com/apex/up/internal/stats" 9 "github.com/pkg/errors" 10 "github.com/tj/kingpin" 11 ) 12 13 func init() { 14 cmd := root.Command("config", "Show configuration after defaults and validation.") 15 cmd.Example(`up config`, "Show the config.") 16 17 cmd.Action(func(_ *kingpin.ParseContext) error { 18 c, _, err := root.Init() 19 if err != nil { 20 return errors.Wrap(err, "initializing") 21 } 22 23 stats.Track("Show Config", nil) 24 25 // note that config is already read in root.go 26 enc := json.NewEncoder(os.Stdout) 27 enc.SetIndent("", " ") 28 enc.Encode(c) 29 30 return nil 31 }) 32 }