add flags parsing (may remove for prompt/args)

This commit is contained in:
Callan Bryant 2020-03-02 01:35:59 +00:00
parent 0e06d0181f
commit 27e0fcf327
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA
2 changed files with 8 additions and 2 deletions

2
add.go
View File

@ -1,5 +1,5 @@
package dsnet
func Add(owner string, name string, description string, publicKey string) {
func Add(hostname string, owner string, description string, publicKey string) {
}

View File

@ -11,6 +11,10 @@ func main() {
var cmd string
addCmd := flag.NewFlagSet("add", flag.ExitOnError)
hostname := addCmd.String("hostname", "", "Hostname of device")
owner := addCmd.String("owner", "", "Username of owner of device")
description := addCmd.String("description", "", "Information about device")
publicKey := addCmd.String("publicKey", "", "Optional existing public key of device")
@ -25,7 +29,9 @@ func main() {
dsnet.Init()
case "add":
dsnet.Add()
addCmd.PrintDefaults()
addCmd.Parse(os.Args[2:])
dsnet.Add(*hostname, *owner, *description, *publicKey)
case "up":