Bug fixes and features #1

Merged
witten merged 12 commits from deroshkin/novel-stats-fork:deroshkin_branch into master 2021-10-22 20:05:18 +00:00
1 changed files with 22 additions and 20 deletions
Showing only changes of commit d79e3f5b80 - Show all commits

View File

@ -79,12 +79,12 @@ def main():
word_count_by_act[act_heading] += word_count_by_chapter[chapter_heading]
total_word_count += word_count_by_chapter[chapter_heading]
if '-c' in arguments or '--chapter' in arguments:
# Print out word counts.
for chapter_heading, chapter_word_count in word_count_by_chapter.items():
if chapter_heading is None:
continue
if len(status_by_chapter[chapter_heading]) > 1:
print(f'chapter {chapter_heading}:')
@ -97,15 +97,17 @@ def main():
else:
print(f'chapter {chapter_heading}: {chapter_word_count:,}')
print()
if '-a' in arguments or '--act' in arguments:
for act_heading, act_word_count in word_count_by_act.items():
if act_heading is None:
continue
print('act {}: {:,} words (~{}%)'.format(act_heading, act_word_count, act_word_count * 100 // total_word_count))
print()
for status, status_word_count in word_count_by_status.items():
print('{}: {:,} words (~{}%)'.format(status, status_word_count, status_word_count * 100 // total_word_count))