add short check if config can be written

This commit is contained in:
Christian Goll
2022-09-19 11:03:49 +02:00
parent 54dd8b3d2f
commit 7c453066fa
4 changed files with 180 additions and 90 deletions

View File

@@ -19,6 +19,11 @@ import (
)
func CobraRunE(cmd *cobra.Command, args []string) error {
canWrite := apiutil.CanWriteConfig()
if !canWrite.CanWriteConfig {
wwlog.Error("Can't write to config exiting")
os.Exit(1)
}
editor := os.Getenv("EDITOR")
if editor == "" {
editor = "/bin/vi"