myl 0.8.11__tar.gz → 0.8.12__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: myl
3
- Version: 0.8.11
3
+ Version: 0.8.12
4
4
  Summary: Dead simple IMAP CLI client
5
5
  Author-email: Philipp Schmitt <philipp@schmitt.co>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: myl
3
- Version: 0.8.11
3
+ Version: 0.8.12
4
4
  Summary: Dead simple IMAP CLI client
5
5
  Author-email: Philipp Schmitt <philipp@schmitt.co>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -73,8 +73,12 @@ def parse_args():
73
73
  parser.add_argument(
74
74
  "-u", "--username", help="IMAP username", required=True
75
75
  )
76
- parser.add_argument(
77
- "-p", "--password", help="IMAP password", required=True
76
+ password_group = parser.add_mutually_exclusive_group(required=True)
77
+ password_group.add_argument("-p", "--password", help="IMAP password")
78
+ password_group.add_argument(
79
+ "--password-file",
80
+ help="IMAP password (file path)",
81
+ type=argparse.FileType("r"),
78
82
  )
79
83
  parser.add_argument(
80
84
  "-t", "--no-title", help="Do not show title", action="store_true"
@@ -119,6 +123,10 @@ def main():
119
123
  )
120
124
  LOGGER.debug(args)
121
125
 
126
+ imap_password = args.password or (
127
+ args.password_file and args.password_file.read()
128
+ )
129
+
122
130
  if args.google:
123
131
  args.server = GMAIL_IMAP_SERVER
124
132
  args.port = GMAIL_IMAP_PORT
@@ -132,7 +140,7 @@ def main():
132
140
  if args.auto:
133
141
  try:
134
142
  settings = autodiscover(
135
- args.username, password=args.password
143
+ args.username, password=imap_password
136
144
  ).get("imap")
137
145
  except Exception:
138
146
  error_msg("Failed to autodiscover IMAP settings")
@@ -191,7 +199,7 @@ def main():
191
199
 
192
200
  try:
193
201
  with mb(**mb_kwargs).login(
194
- args.username, args.password, args.folder
202
+ args.username, imap_password, args.folder
195
203
  ) as mailbox:
196
204
  if args.MAILID:
197
205
  msg = next(
@@ -293,13 +301,15 @@ def main():
293
301
  else "???"
294
302
  ),
295
303
  )
296
- if len(table.rows) >= args.count:
304
+ if table.row_count >= args.count:
297
305
  break
298
306
 
299
307
  if args.json:
300
308
  print_json(json.dumps(json_data))
301
309
  else:
302
310
  console.print(table)
311
+ if table.row_count == 0:
312
+ print("[yellow italic]No messages[/yellow italic]", file=sys.stderr)
303
313
  return 0
304
314
  except Exception:
305
315
  console.print_exception(show_locals=True)
@@ -21,7 +21,7 @@ dependencies = [
21
21
  "rich >= 13.0.0, <14.0.0",
22
22
  "html2text >= 2024.2.26"
23
23
  ]
24
- version = "0.8.11"
24
+ version = "0.8.12"
25
25
 
26
26
  [project.urls]
27
27
  homepage = "https://github.com/pschmitt/myl"
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