| Commit message (Collapse) | Author | Lines |
|
If quarg is unable to find the database URL, it immediately exits with
an error message. This happens before parsing any arguments given on the
command line, meaning that users cannot access the built-in help page if
they have not yet created a config file.
This commit makes sure that command line arguments are parsed before
checking the config file so that --help can be used even without a
config file.
|
|
Whilst not recommended, quarg may happen to be used in conjunction with
head(1), tail(1), or any other program that will send SIGPIPE. This
commit makes sure that we close the database connection properly if we
receive that signal.
|
|
This reverts commit efde2954efd636a617702ee1aefb8b1247c9cc5b.
After some more consideration, we feel that referring to modes here is
misleading and confusing. Compromise by keeping the -m flag, but
changing the variable name back to 'prefix' and making clear in the help
message that quarg will match against the "channel membership prefix", a
term that is used in the Modern IRC Client Protocol specification [1]
[1] https://modern.ircdocs.horse/#channel-membership-prefixes
|
|
Users may want to cancel queries that are taking a long time. This
commit ensures that the database is left in a clean state and that quarg
exits immediately after closing the database connection.
|
|
Instead of giving the user a screen full of backtraces, catch any errors
SQLAlchemy can run into when preparing or executing the query and report
only the error message to the user.
We include the print loop in the try/except block because an upcoming
commit will add a handler for KeyboardInterrupt.
|
|
This commit cleanly separates the preparation, execution, and timing of
a query. When preparing this commit, we realized that the preparation of
the query was included in the timer calculation. This should not have
been the case and has been fixed.
|
|
As mentioned in the previous commit, this change makes it possible to
select the first or last N matches in conjunction with the -l flag.
|
|
This is useful if the user already expects a lot of matches but is only
interested in a limited number of them. An upcoming commit will
introduce the option to have quarg list matches in ascending or
descending order (currently we do not pick a default - effectively
listing matches in ascending timestamp order), making it possible to
select the first or last N matches.
|
|
Up until now it was only possible to give --around a range specified in
hours. Since most discussions on IRC tend not to last for multiple
hours, and one may only be interested in a few minutes of logs, this
commit adds the ability to specify a unit suffix that takes either 'm'
for minutes or 'h' for hours. If it is missing, 'h' is assumed.
|
|
Group message matching into two main parts (context and timestamps) and
simplify the help text for each option. Rename 'query' to 'keyword' to
avoid confusion with SQL queries and IRC queries.
Additionally, change some option flags to better communicate the type of
option (upper-case ones are used less frequently) or to make sure no
future option clashes with a less-frequently used one.
|
|
Whilst still not perfect, 'umode' signals more closely what this option
does. We do not plan to add matching on channel modes, so -m should be
fine here.
The original name for this option came from the column in the backlog
table, 'senderprefixes'.
|
|
|
|
These make more sense and are clearer if they're named after the command
line arguments that trigger them.
|
|
Using --around does not make much sense if there is also a match on
--after or --before, since the range in --around would most certainly
take precedence. Disallow this behaviour.
|
|
Sadly we can not yet rely on BooleanOptionalAction, since that was only
added in Python 3.9. Also remove the FIXME note, it seems that boolean
options like this trigger a standard default setting with argparse.
|
|
|
|
We're going to need this for an upcoming commit that moves all
argparse.Action classes to its own file.
|
|
Instead of adding another indentation level, exit early if a value or a
key can be ignored.
|