diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-02 14:47:02 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-02 14:47:02 -0500 |
commit | 9ab2e0044c8976b5669a069e61479354ca52980c (patch) | |
tree | a62f31483c0ee055fe83376f71971e01ddc02320 /conf/main.go | |
parent | ad6a617c12d9b341be1357dcbb6ab58febe32ee8 (diff) |
add endpoint.go
Diffstat (limited to 'conf/main.go')
-rw-r--r-- | conf/main.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/conf/main.go b/conf/main.go index dcd9737..182d97f 100644 --- a/conf/main.go +++ b/conf/main.go @@ -5,6 +5,8 @@ import ( "fmt" "log" "flag" + "strings" + "bufio" db "sanine.net/git/phlox/db" ) @@ -39,6 +41,19 @@ func OpenDb() { } +func ReadLine(prompt string) string { + reader := bufio.NewReader(os.Stdin) + + fmt.Print(prompt) + line, err := reader.ReadString('\n') + if err != nil { + log.Fatal(err) + } + + return strings.TrimSpace(line) +} + + func main() { p = &db.Phlox{} @@ -50,6 +65,12 @@ func main() { 4: DeleteUser(), 5: UpdatePassword(), 6: ListUsers(), + + 7: CreateEndpoint(), + 8: DeleteEndpoint(), + 9: SetPath(), + 10: SetAddress(), + 11: ListEndpoints(), } for val, cmd := range cmds { |