lib/kitabu/cli.rb in kitabu-1.0.0 vs lib/kitabu/cli.rb in kitabu-1.0.1

- old
+ new

@@ -98,9 +98,24 @@ text << color(permalink, :yellow) say(text) end end + desc "stats", "Display some stats about your e-book" + def stats + inside_ebook! + stats = Kitabu::Stats.new(root_dir) + + say [ + "Chapters: #{stats.chapters}", + "Words: #{stats.words}", + "Images: #{stats.images}", + "Links: #{stats.links}", + "Footnotes: #{stats.footnotes}", + "Code blocks: #{stats.code_blocks}" + ].join("\n") + end + private def inside_ebook! unless File.exist?(config_path) raise Error, "You have to run this command from inside an e-book directory." end