From 3a58eb320e505b73572b4f59804f20b12e37a0a9 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sun, 29 Oct 2017 22:22:16 +0100 Subject: strip empty #splat --- notyet | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'notyet') diff --git a/notyet b/notyet index 62a72d4..925722d 100755 --- a/notyet +++ b/notyet @@ -90,10 +90,14 @@ class Entry < Struct.new(:depth, :state, :desc, :file, :line, :children) self.children = children.map { |c| c.splat - if c.desc == "#splat" && !c.children.empty? - sub = c.children.map { |cc| cc.children }.flatten - rel = sub.first.depth - c.depth - sub.map { |cc| cc.reindent(-rel) } + if c.desc == "#splat" + if c.children.empty? + [] + else + sub = c.children.map { |cc| cc.children }.flatten + rel = sub.first.depth - c.depth + sub.map { |cc| cc.reindent(-rel) } + end else [c] end @@ -143,7 +147,6 @@ def parse(io, filename=nil) children = [] if desc =~ /^#exec\s+(.+)/ -# - error handling for #exec Dir.chdir(File.dirname(fname)) { begin IO.popen($1) { |f| -- cgit 1.4.1