From 55f346f7aaed303f956ceb95bce8e8aa0a5ea28f Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Mon, 11 May 2020 02:42:37 -0400 Subject: added plaintext response to user list query --- users.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/users.go b/users.go index a40c177..1f8cfb3 100644 --- a/users.go +++ b/users.go @@ -15,6 +15,20 @@ func usersQuery(format string) ([]byte, error) { } users := strings.Fields(string(ls)) + + if format == "plain" { + var out []string + for _, e := range users { + if strings.HasPrefix(e, ".") || strings.HasPrefix(e, "_") { + continue + } + out = append(out, e) + } + outstring := strings.Join(out, "\n") + outstring += "\n" + return []byte(outstring), nil + } + out := `{ "users": [ ` -- cgit 1.4.1-2-gfad0