myl 0.9.2__tar.gz → 0.9.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {myl-0.9.2 → myl-0.9.4}/.gitignore +1 -0
- {myl-0.9.2 → myl-0.9.4}/PKG-INFO +2 -2
- {myl-0.9.2 → myl-0.9.4}/myl.egg-info/PKG-INFO +2 -2
- {myl-0.9.2 → myl-0.9.4}/myl.py +34 -4
- myl-0.9.4/version.txt +1 -0
- myl-0.9.2/version.txt +0 -1
- {myl-0.9.2 → myl-0.9.4}/.github/dependabot.yml +0 -0
- {myl-0.9.2 → myl-0.9.4}/.github/workflows/lint.yaml +0 -0
- {myl-0.9.2 → myl-0.9.4}/.github/workflows/pypi.yaml +0 -0
- {myl-0.9.2 → myl-0.9.4}/.github/workflows/release.yaml +0 -0
- {myl-0.9.2 → myl-0.9.4}/LICENSE +0 -0
- {myl-0.9.2 → myl-0.9.4}/README.md +0 -0
- {myl-0.9.2 → myl-0.9.4}/flake.lock +0 -0
- {myl-0.9.2 → myl-0.9.4}/flake.nix +0 -0
- {myl-0.9.2 → myl-0.9.4}/myl.egg-info/SOURCES.txt +0 -0
- {myl-0.9.2 → myl-0.9.4}/myl.egg-info/dependency_links.txt +0 -0
- {myl-0.9.2 → myl-0.9.4}/myl.egg-info/entry_points.txt +0 -0
- {myl-0.9.2 → myl-0.9.4}/myl.egg-info/requires.txt +0 -0
- {myl-0.9.2 → myl-0.9.4}/myl.egg-info/top_level.txt +0 -0
- {myl-0.9.2 → myl-0.9.4}/pyproject.toml +0 -0
- {myl-0.9.2 → myl-0.9.4}/setup.cfg +0 -0
{myl-0.9.2 → myl-0.9.4}/PKG-INFO
RENAMED
{myl-0.9.2 → myl-0.9.4}/myl.py
RENAMED
@@ -98,6 +98,17 @@ def parse_args():
|
|
98
98
|
default=None,
|
99
99
|
)
|
100
100
|
|
101
|
+
# get most recent email
|
102
|
+
last_parser = subparsers.add_parser(
|
103
|
+
"last", aliases=["-1"], help="Retrieve the most recent email"
|
104
|
+
)
|
105
|
+
last_parser.add_argument(
|
106
|
+
"ATTACHMENT",
|
107
|
+
help="Name of the attachment to fetch",
|
108
|
+
nargs="?",
|
109
|
+
default=None,
|
110
|
+
)
|
111
|
+
|
101
112
|
# Delete email command
|
102
113
|
delete_parser = subparsers.add_parser("delete", help="Delete an email")
|
103
114
|
delete_parser.add_argument(
|
@@ -139,7 +150,7 @@ def parse_args():
|
|
139
150
|
"--auto",
|
140
151
|
help="Autodiscovery of the required server and port",
|
141
152
|
action="store_true",
|
142
|
-
default=
|
153
|
+
default=False,
|
143
154
|
)
|
144
155
|
parser.add_argument(
|
145
156
|
"-P", "--port", help="IMAP server port", default=IMAP_PORT
|
@@ -301,15 +312,23 @@ def mb_connect(console, args) -> BaseMailBox:
|
|
301
312
|
|
302
313
|
def display_single_mail(
|
303
314
|
mailbox: BaseMailBox,
|
304
|
-
mail_id: int,
|
315
|
+
mail_id: int | None = None,
|
305
316
|
attachment: str | None = None,
|
306
317
|
mark_seen: bool = False,
|
307
318
|
raw: bool = False,
|
308
319
|
html: bool = False,
|
309
320
|
json: bool = False,
|
310
321
|
):
|
311
|
-
|
312
|
-
|
322
|
+
if mail_id is None:
|
323
|
+
LOGGER.debug("No mail_id provided, fetching the most recent mail")
|
324
|
+
msg = next(
|
325
|
+
mailbox.fetch(
|
326
|
+
"ALL", reverse=True, bulk=True, limit=1, mark_seen=mark_seen
|
327
|
+
)
|
328
|
+
)
|
329
|
+
else:
|
330
|
+
LOGGER.debug("Fetch mail %s", mail_id)
|
331
|
+
msg = next(mailbox.fetch(f"UID {mail_id}", mark_seen=mark_seen))
|
313
332
|
LOGGER.debug("Fetched mail %s", msg)
|
314
333
|
|
315
334
|
if attachment:
|
@@ -476,6 +495,17 @@ def main() -> int:
|
|
476
495
|
json=args.json,
|
477
496
|
)
|
478
497
|
|
498
|
+
elif args.command in ["-1", "last"]:
|
499
|
+
return display_single_mail(
|
500
|
+
mailbox=mailbox,
|
501
|
+
mail_id=None,
|
502
|
+
attachment=args.ATTACHMENT,
|
503
|
+
mark_seen=args.mark_seen,
|
504
|
+
raw=args.raw,
|
505
|
+
html=args.html,
|
506
|
+
json=args.json,
|
507
|
+
)
|
508
|
+
|
479
509
|
# mark emails as read
|
480
510
|
elif args.command in ["read"]:
|
481
511
|
return mark_read(
|
myl-0.9.4/version.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.4
|
myl-0.9.2/version.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.9.2
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{myl-0.9.2 → myl-0.9.4}/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|