added some extra commands
All checks were successful
Go / build-test-publish (1.23.4) (push) Successful in 43s

This commit is contained in:
Denys Seredenko
2025-01-14 16:27:50 +01:00
parent c2d06f2b7f
commit ca2d6bbc67
4 changed files with 125 additions and 0 deletions

21
util/util.go Normal file
View File

@@ -0,0 +1,21 @@
package util
import (
"encoding/json"
"github.com/spf13/cobra"
"os"
)
func SaveConfig(data *map[string]string) error {
jsonData, err := json.Marshal(data)
cobra.CheckErr(err)
homeDir, err := os.UserHomeDir()
cobra.CheckErr(err)
f, err := os.Create(homeDir + "/.ssh-hub-config.json")
cobra.CheckErr(err)
_, err = f.Write(jsonData)
cobra.CheckErr(err)
return nil
}