]>
git.wh0rd.org - home.git/blob - .config/mutt/list-mailboxes.py
3 """Produce a "sorted" list of maildir paths based on subdirs."""
5 from pathlib
import Path
14 '.gentoo.org.directory/.bugs.directory/.arches.directory/noise',
21 def find_dirs(topdir
, ignored
):
22 """Walk the subdirs following the KDE layout."""
23 for d
in sorted(topdir
.iterdir()):
24 if d
.name
in MAILDIR_DIRS
:
29 if not d
.is_symlink():
30 if (d
/ 'cur').is_dir():
32 subdir
= topdir
/ f
'.{d.name}.directory'
33 if subdir
not in ignored
and subdir
.is_dir():
34 yield from find_dirs(subdir
, ignored
)
38 maildir
= Path('~/.mail/').expanduser()
39 ignored
= {maildir
/ x
for x
in IGNORED_DIRS
}
41 results
= find_dirs(maildir
, ignored
)
42 print(' '.join(f
'"{x}"' for x
in results
))
46 if __name__
== '__main__':
47 sys
.exit(main(sys
.argv
[1:]))