37 lines
624 B
Go
Raw Normal View History

2025-08-23 19:14:16 +02:00
package config
import (
"bytes"
2025-08-23 19:14:16 +02:00
"context"
"fmt"
"github.com/BurntSushi/toml"
2025-08-23 19:14:16 +02:00
"github.com/urfave/cli/v3"
)
// GetConfig Command
func GetConfig() *cli.Command {
return &cli.Command{
Name: "get",
Usage: "read configuration file",
Action: getConfigAction,
}
}
// getConfigAction logic for GetConfig
func getConfigAction(context context.Context, c *cli.Command) error {
configFile, err := ReadConfig()
2025-08-23 19:14:16 +02:00
if err != nil {
return err
}
var buf bytes.Buffer
if err := toml.NewEncoder(&buf).Encode(configFile); err != nil {
2025-08-23 19:14:16 +02:00
return err
}
tomlString := buf.String()
fmt.Println(tomlString)
2025-08-23 19:14:16 +02:00
return nil
}