2023-10-15 19:29:29 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2023-10-16 19:41:33 +00:00
|
|
|
"github.com/thegeeklab/git-sv/app"
|
2023-10-15 19:29:29 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
2023-10-15 19:45:47 +00:00
|
|
|
"gopkg.in/yaml.v3"
|
2023-10-15 19:29:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func ConfigDefaultHandler() cli.ActionFunc {
|
2024-02-12 08:09:42 +00:00
|
|
|
return func(_ *cli.Context) error {
|
2023-10-15 19:29:29 +00:00
|
|
|
cfg := app.GetDefault()
|
|
|
|
|
|
|
|
content, err := yaml.Marshal(&cfg)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(string(content))
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func ConfigShowHandler(cfg *app.Config) cli.ActionFunc {
|
2024-02-12 08:09:42 +00:00
|
|
|
return func(_ *cli.Context) error {
|
2023-10-15 19:29:29 +00:00
|
|
|
content, err := yaml.Marshal(cfg)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(string(content))
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|