mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-11 00:58:31 +02:00
Merges pull request #49 from dedan/remove_single_tags
* remove_single_tags: Cleaner syntax and messages remove tags that were used only once.
This commit is contained in:
commit
caad0bdbae
1 changed files with 8 additions and 6 deletions
|
@ -105,7 +105,10 @@ def print_tags(journal):
|
||||||
]
|
]
|
||||||
# To be read: [for entry in journal.entries: for tag in set(entry.tags): tag]
|
# To be read: [for entry in journal.entries: for tag in set(entry.tags): tag]
|
||||||
tag_counts = {(tags.count(tag), tag) for tag in tags}
|
tag_counts = {(tags.count(tag), tag) for tag in tags}
|
||||||
for n, tag in sorted(tag_counts, reverse=True):
|
if min(tag_counts)[0] == 0:
|
||||||
|
tag_counts = filter(lambda x: x[0] > 1, tag_counts)
|
||||||
|
print('[Removed tags that appear only once.]')
|
||||||
|
for n, tag in sorted(tag_counts, reverse=False):
|
||||||
print("{:20} : {}".format(tag, n))
|
print("{:20} : {}".format(tag, n))
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,4 +221,3 @@ def cli():
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
cli()
|
cli()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue