From 250ed56bc4d54a0ed68bcf6ed1939e9c12f5df15 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 16 Oct 2017 16:40:12 +0200 Subject: add -c flag to count only --- notyet | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/notyet b/notyet index 0bcaf6c..aacb9d6 100755 --- a/notyet +++ b/notyet @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -# notyet [-a] [-e] [-f FILE] [FILTER] - a todo tracker +# notyet [-a] [-c] [-e] [-f FILE] [FILTER] - a todo tracker # # notyet is in the public domain. # To the extent possible under law, Leah Neukirchen @@ -179,9 +179,11 @@ end files = [] filter = [] $show_all = $edit = false +count_only = false ARGV.each_with_index { |arg, i| case arg when "-a"; $show_all = true + when "-c"; count_only = true when "-f"; files << ARGV.delete_at(i+1) when "-e"; $edit = true when /^-/; abort "Usage: notyet XXX" @@ -209,6 +211,11 @@ t.propagate t.sort t.filter(filter) +if count_only + puts "#{t.count("xX")}/#{t.count("-xX")}" + exit +end + if $edit && STDOUT.tty? rd, wr = IO.pipe $stdout = wr -- cgit 1.4.1