add options to further suppress output
This commit adds the ability to further suppress output for accounts with no deleted toots using the `-qq` flag. It alsoadds the option to completely suppress logging (excluding exceptions) by using the `-qqq` flag
This commit is contained in:
parent
0bd6831f44
commit
7aed1e8d1a
|
@ -69,7 +69,7 @@ If you skip a lot of items (e.g. you skip direct messages) it may clutter your l
|
||||||
|
|
||||||
### Hide everything (--quiet)
|
### Hide everything (--quiet)
|
||||||
|
|
||||||
Use the `--quiet` flag to suppress all logging except for the account name being checked and the number of toots deleted. Exception messages will not be suppressed.
|
Use the `--quiet` or `-q` flag to suppress all logging except for the account name being checked and the number of toots deleted. Use the `-qq` flag to further suppress output for accounts with zero deleted toots. The `-qqq` flag will suppress all output. Exception messages will not be suppressed.
|
||||||
|
|
||||||
### Only archive deleted toots (--archive-deleted)
|
### Only archive deleted toots (--archive-deleted)
|
||||||
|
|
||||||
|
@ -130,4 +130,4 @@ ephemetoot --schedule --time 14 25
|
||||||
* [Home](index.md)
|
* [Home](index.md)
|
||||||
* [Installation](install.md)
|
* [Installation](install.md)
|
||||||
* [Upgrading and uninstalling](upgrade.md)
|
* [Upgrading and uninstalling](upgrade.md)
|
||||||
* [Contributing](contributing.md)
|
* [Contributing](contributing.md)
|
||||||
|
|
|
@ -72,7 +72,12 @@ parser.add_argument(
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Slow deletion actions to match API rate limit to avoid pausing",
|
help="Slow deletion actions to match API rate limit to avoid pausing",
|
||||||
)
|
)
|
||||||
parser.add_argument("--quiet", action="store_true", help="Suppress most logging")
|
parser.add_argument(
|
||||||
|
"-q",
|
||||||
|
"--quiet",
|
||||||
|
action="count",
|
||||||
|
help="Limits logging to one line per account. Use -qq to limit logging to accounts with deleted toots and -qqq to completely suppress logging.",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--retry-mins",
|
"--retry-mins",
|
||||||
action="store",
|
action="store",
|
||||||
|
|
|
@ -437,7 +437,21 @@ def check_batch(config, options, mastodon, user_id, timeline, deleted_count=0):
|
||||||
if options.datestamp:
|
if options.datestamp:
|
||||||
print("\n", datestamp_now(), end=" : ")
|
print("\n", datestamp_now(), end=" : ")
|
||||||
|
|
||||||
print("Removed " + str(deleted_count) + " toots.\n")
|
# options.quiet can be None
|
||||||
|
if (
|
||||||
|
(not options.quiet)
|
||||||
|
or options.quiet <= 1
|
||||||
|
or (options.quiet == 2 and deleted_count)
|
||||||
|
):
|
||||||
|
print(
|
||||||
|
"Removed "
|
||||||
|
+ str(deleted_count)
|
||||||
|
+ " toots for "
|
||||||
|
+ config["username"]
|
||||||
|
+ "@"
|
||||||
|
+ config["base_url"]
|
||||||
|
+ ".\n"
|
||||||
|
)
|
||||||
|
|
||||||
if not options.quiet:
|
if not options.quiet:
|
||||||
print("---------------------------------------")
|
print("---------------------------------------")
|
||||||
|
@ -471,13 +485,14 @@ def check_toots(config, options, retry_count=0):
|
||||||
The main function, uses the Mastodon API to check all toots in the user timeline, and delete any that do not meet any of the exclusion criteria from the config file.
|
The main function, uses the Mastodon API to check all toots in the user timeline, and delete any that do not meet any of the exclusion criteria from the config file.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
print(
|
if not options.quiet:
|
||||||
"Fetching account details for @",
|
print(
|
||||||
config["username"],
|
"Fetching account details for @",
|
||||||
"@",
|
config["username"],
|
||||||
config["base_url"],
|
"@",
|
||||||
sep="",
|
config["base_url"],
|
||||||
)
|
sep="",
|
||||||
|
)
|
||||||
|
|
||||||
if options.pace:
|
if options.pace:
|
||||||
mastodon = Mastodon(
|
mastodon = Mastodon(
|
||||||
|
|
|
@ -239,7 +239,7 @@ def test_check_batch(capfd, monkeypatch):
|
||||||
ephemetoot.check_batch(config, options, mastodon, user_id, timeline, 0)
|
ephemetoot.check_batch(config, options, mastodon, user_id, timeline, 0)
|
||||||
# deleted_count should be 10
|
# deleted_count should be 10
|
||||||
output = capfd.readouterr().out.split("\n")
|
output = capfd.readouterr().out.split("\n")
|
||||||
assert output[0] == "Removed 10 toots."
|
assert output[0] == "Removed 10 toots for alice@test.social."
|
||||||
|
|
||||||
|
|
||||||
def test_console_print(capfd):
|
def test_console_print(capfd):
|
||||||
|
|
Loading…
Reference in New Issue