diff options
Diffstat (limited to '')
-rw-r--r-- | scoop.1 | 7 | ||||
-rw-r--r-- | scoop.c | 12 |
2 files changed, 14 insertions, 5 deletions
diff --git a/scoop.1 b/scoop.1 index 1a66040..693c033 100644 --- a/scoop.1 +++ b/scoop.1 @@ -1,4 +1,4 @@ -.Dd April 27, 2021 +.Dd April 28, 2021 .Dt SCOOP 1 .Os . @@ -174,9 +174,10 @@ Sort the results from oldest to newest. By default events are output in the order they appear in the database. . -.It Fl t Ar type +.It Fl t Ar types Match events of -.Ar type . +the comma-separated list of +.Ar types . The types are .Cm privmsg , .Cm notice , diff --git a/scoop.c b/scoop.c index 6c2957b..f1c0ed2 100644 --- a/scoop.c +++ b/scoop.c @@ -344,6 +344,14 @@ static enum Type parseType(const char *input) { errx(EX_USAGE, "no such type %s", input); } +static int parseTypes(char *list) { + int mask = 0; + while (list) { + mask |= 1 << parseType(strsep(&list, ",")); + } + return mask; +} + int main(int argc, char *argv[]) { bool tty = isatty(STDOUT_FILENO); @@ -466,8 +474,8 @@ int main(int argc, char *argv[]) { sort = true; } break; case 't': { - append(where, SQL(AND events.type = :type)); - binds[n++] = Bind(":type", NULL, parseType(optarg)); + append(where, SQL(AND (1 << events.type) & :types)); + binds[n++] = Bind(":types", NULL, parseTypes(optarg)); } break; case 'u': { append(where, SQL(AND names.user = :user)); |