mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
remove tags that were used only once.
I sometimes look at the overview of tags with `jrnl --tags` and there I found it annoying to see all the tags that appeared only once. Those are now filtered out and I print a comment saying that they were filtered out Also changed the order (sorted by counts) in which the tags are printed. For a CLI application I think it is nicer to see the more important version at the end
This commit is contained in:
parent
123000ce41
commit
a8777b747a
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]
|
||||
tag_counts = {(tags.count(tag), tag) for tag in tags}
|
||||
for n, tag in sorted(tag_counts, reverse=True):
|
||||
if len([t for t in tag_counts if t[0] == 1]):
|
||||
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))
|
||||
|
||||
|
||||
|
@ -218,4 +221,3 @@ def cli():
|
|||
if __name__ == "__main__":
|
||||
cli()
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue