Update home config

This commit is contained in:
Tom 2023-04-27 14:57:43 +02:00
parent 44af84abe9
commit 8c4de32246
9 changed files with 30 additions and 18 deletions

View file

@ -9,7 +9,9 @@ import (
// Config is the configuration command
var Config wisski_distillery.Command = cfg{}
type cfg struct{}
type cfg struct {
Human bool `long:"human" description:"Print configuration in human-readable format"`
}
func (c cfg) Description() wisski_distillery.Description {
return wisski_distillery.Description{
@ -26,7 +28,12 @@ var errMarshalConfig = exit.Error{
ExitCode: exit.ExitGeneric,
}
func (cfg) Run(context wisski_distillery.Context) error {
func (cfg cfg) Run(context wisski_distillery.Context) error {
if cfg.Human {
human := context.Environment.Config.MarshalSensitive()
context.Println(human)
return nil
}
if err := context.Environment.Config.Marshal(context.Stdout); err != nil {
return errMarshalConfig.Wrap(err)
}