2020-03-05 21:35:51 +01:00
|
|
|
package dsnet
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Remove() {
|
2020-03-14 15:51:49 +01:00
|
|
|
if len(os.Args) != 3 {
|
2020-03-05 23:13:09 +01:00
|
|
|
// TODO non-red
|
2020-03-05 21:35:51 +01:00
|
|
|
ExitFail("Hostname argument required: dsnet remove <hostname>")
|
|
|
|
}
|
2020-03-08 15:13:29 +01:00
|
|
|
|
2020-03-05 21:35:51 +01:00
|
|
|
conf := MustLoadDsnetConfig()
|
|
|
|
hostname := os.Args[2]
|
|
|
|
conf.MustRemovePeer(hostname)
|
2020-03-08 20:08:19 +01:00
|
|
|
ConfirmOrAbort("Do you really want to remove %s?", os.Args[2])
|
2020-03-05 21:35:51 +01:00
|
|
|
conf.MustSave()
|
2020-03-05 21:43:31 +01:00
|
|
|
ConfigureDevice(conf)
|
2020-03-05 21:35:51 +01:00
|
|
|
}
|