From 9ab2e0044c8976b5669a069e61479354ca52980c Mon Sep 17 00:00:00 2001 From: sanine-a Date: Tue, 2 May 2023 14:47:02 -0500 Subject: add endpoint.go --- conf/main.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'conf/main.go') 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 { -- cgit v1.2.1