Using the commandline to write a book

As I've mentioned many times already, I'm currently writing an ebook, "Your First Product", to help people like you to build and promote your first software product.

I have a daily target to write 200 words toward the book (which I smash! ;)). And I track my progress using a short powershell script that also commits what I've written (to mercurial).

Here's the progress currently, as output by ".\count.ps1", my count and commit script.

2014-10-01,words:22515, tasks: 85/130
2014-09-30,words:21896, tasks: 85/130
2014-09-29,words:21467, tasks: 85/130
2014-09-28,words:21246, tasks: 85/130
2014-09-26,words:20925, tasks: 85/130
2014-09-25,words:20707, tasks: 85/130
2014-09-24,words:19496, tasks: 80/126
2014-09-22,words:19109, tasks: 80/126
2014-09-21,words:17898, tasks: 82/128
2014-09-19,words:17323, tasks: 82/128
2014-09-18,words:16211, tasks: 82/128
2014-09-17,words:15194, tasks: 82/128
2014-09-16,words:14824, tasks: 82/128
2014-09-15,words:13479, tasks: 82/128
2014-09-14,words:12463, tasks: 82/128
2014-09-12,words:10854, tasks: 82/128
2014-09-11,words:9571, tasks: 82/127
2014-09-10,words:6900, tasks: 79/124
2014-09-09,words:5274, tasks: 79/124
2014-09-08,words:4585, tasks: 79/124
2014-09-07,words:3237, tasks: 78/121
2014-09-04,words:1548, tasks: 62/95
2014-09-03,words:1217, tasks: 52/74
2014-09-02,words:697, tasks: 22/41
2014-09-01,317 words
619 words today (309.5%), 0 tasks today

I've made 290 commits, but count only shows details from the final commit on each day. And it compares yesterday to today to come up with my today's progress.

Here's the .\count.ps1 script itself (and the .\progress.ps1 script which it calls).

I have another script, ".\stats.ps1" that I call to see the number of words in each chapter (from biggest to smallest), another called ".\chapters.ps1" which gives me a basic table of contents, and one more script, ".\bake.ps1" that converts the markdown into an epub (using pandoc).

These are all very very rudimentary. Any effort I put into them is effort that I'm not putting into the writing itself. But I would love to make them a whole lot better.

I'd love to have graphs. Right there in the console. Or alternatively, pop-up graphs.

I'd love to have git versions, as well, instead of just mercurial. And bash versions, and node.js versions instead of just powershell. And versions for people who write TeX, not just markdown, and so on.

I'd love to be able to plug-in other metrics! Instead of just measuring words in markdown files and [_]'s in "todo.txt" files, I'd like to measure lines of code, TODO: tokens in code, number of unit tests, and so on. Extensibly.

Thoughts? Forks? All welcome.

But for now.... back to my lonely writer's garret, and the pounding out of imperfect prose...


  • count.ps1, determine number of words added to .md files, and number of tasks done in todo.txt; craft a commit message with this data, and commit all work.
  • progress.ps1, give details about daily word and task counts, and show today's progress as a percent of goal.
  • stats.ps1, summarize the numbers of words in each markdown file, and display them by size descending.
  • chapters.ps1, gives me a basic table of contents for the book I'm working on.
  • bake.ps1, generates an epub for me, using pandoc, with my chosen cover image, stylesheet, yaml metadata and my chapters

My book "Choose Your First Product" is available now.

It gives you 4 easy steps to find and validate a humble product idea.

Learn more.

(By the way, I read every comment and often respond.)

Your comment, please?

Your Name
Your Url (optional)
Note: I may edit, reuse or delete your comment. Don't be mean.