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)
|
||||
|
||||
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)
|
||||
|
||||
|
@ -130,4 +130,4 @@ ephemetoot --schedule --time 14 25
|
|||
* [Home](index.md)
|
||||
* [Installation](install.md)
|
||||
* [Upgrading and uninstalling](upgrade.md)
|
||||
* [Contributing](contributing.md)
|
||||
* [Contributing](contributing.md)
|
||||
|
|
|
@ -72,7 +72,12 @@ parser.add_argument(
|
|||
action="store_true",
|
||||
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(
|
||||
"--retry-mins",
|
||||
action="store",
|
||||
|
|
|
@ -437,7 +437,21 @@ def check_batch(config, options, mastodon, user_id, timeline, deleted_count=0):
|
|||
if options.datestamp:
|
||||
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:
|
||||
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.
|
||||
"""
|
||||
try:
|
||||
print(
|
||||
"Fetching account details for @",
|
||||
config["username"],
|
||||
"@",
|
||||
config["base_url"],
|
||||
sep="",
|
||||
)
|
||||
if not options.quiet:
|
||||
print(
|
||||
"Fetching account details for @",
|
||||
config["username"],
|
||||
"@",
|
||||
config["base_url"],
|
||||
sep="",
|
||||
)
|
||||
|
||||
if options.pace:
|
||||
mastodon = Mastodon(
|
||||
|
|
|
@ -239,7 +239,7 @@ def test_check_batch(capfd, monkeypatch):
|
|||
ephemetoot.check_batch(config, options, mastodon, user_id, timeline, 0)
|
||||
# deleted_count should be 10
|
||||
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):
|
||||
|
|
Loading…
Reference in New Issue