add: hostname as arg like remove

This commit is contained in:
Callan Bryant 2020-03-05 22:13:09 +00:00
parent 8c5aaee793
commit b697afc2ee
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA
2 changed files with 8 additions and 2 deletions

9
add.go
View File

@ -7,11 +7,16 @@ import (
) )
func Add() { func Add() {
// TODO maybe accept flags to avoid prompt and allow programmatic use if len(os.Args) <= 2 {
// TODO non-red
ExitFail("Hostname argument required: dsnet add <hostname>")
}
// TODO maybe accept flags to avoid prompt and allow programmatic use?
// TODO accept existing pubkey // TODO accept existing pubkey
conf := MustLoadDsnetConfig() conf := MustLoadDsnetConfig()
hostname := MustPromptString("Hostname (unique)", true) hostname := os.Args[2]
owner := MustPromptString("owner", true) owner := MustPromptString("owner", true)
description := MustPromptString("Description", true) description := MustPromptString("Description", true)
//publicKey := MustPromptString("PublicKey (optional)", false) //publicKey := MustPromptString("PublicKey (optional)", false)

View File

@ -6,6 +6,7 @@ import (
func Remove() { func Remove() {
if len(os.Args) <= 2 { if len(os.Args) <= 2 {
// TODO non-red
ExitFail("Hostname argument required: dsnet remove <hostname>") ExitFail("Hostname argument required: dsnet remove <hostname>")
} }
conf := MustLoadDsnetConfig() conf := MustLoadDsnetConfig()