PKGBUILD/cmd/remote/disable.go

40 lines
650 B
Go
Raw Normal View History

2018-11-28 11:32:34 +00:00
package remote
import (
"log"
2019-02-17 17:23:59 +00:00
"git.cryptic.systems/fh-trier/go-flucky/pkg/config"
2018-11-28 11:32:34 +00:00
"github.com/spf13/cobra"
)
var disableRemoteCmd = &cobra.Command{
Use: "disable",
Short: "Disable Remove Server",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
2019-02-17 17:23:59 +00:00
// read configuration
fc, err := config.Read(cfg)
if err != nil {
log.Fatalln(err)
2018-11-28 11:32:34 +00:00
}
2019-02-17 17:23:59 +00:00
// disnable remote address
err = fc.DisableRemote(args[0])
if err != nil {
log.Fatalln(err)
}
// save new configuration
err = config.Write(fc, cfg)
if err != nil {
log.Fatalln(err)
}
2018-11-28 11:32:34 +00:00
},
}
func init() {
remoteCmd.AddCommand(disableRemoteCmd)
}