diff options
author | Ben Morrison <ben@gbmor.dev> | 2020-05-11 02:42:37 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2020-05-11 02:42:37 -0400 |
commit | 55f346f7aaed303f956ceb95bce8e8aa0a5ea28f (patch) | |
tree | 57ce820a928fd2bebf3848294ce137a2e3b93aeb | |
parent | a729136a6a7e36a7b717ee5df615339cb4bde654 (diff) | |
download | api-55f346f7aaed303f956ceb95bce8e8aa0a5ea28f.tar.gz |
added plaintext response to user list query
-rw-r--r-- | users.go | 14 |
1 files changed, 14 insertions, 0 deletions
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": [ ` |