added some extra commands
All checks were successful
Go / build-test-publish (1.23.4) (push) Successful in 43s
All checks were successful
Go / build-test-publish (1.23.4) (push) Successful in 43s
This commit is contained in:
21
util/util.go
Normal file
21
util/util.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user