about summary refs log tree commit homepage
path: root/bin
diff options
authorEric Wong <e@80x24.org>2015-12-14 04:48:01 +0000
committerEric Wong <e@80x24.org>2015-12-14 04:48:01 +0000
commit0dde5917fb5135ee3601383c29ffc0490071ea9d (patch)
tree4e2b4f2cb9e42ffbbda3f0b6c0f6d0c96c3cafb6 /bin
parent459519080c929211f5cf2997c22d1155c7fd1383 (diff)
No need to keep track of added track IDs when we can walk the
array backwards to insert in the correct order.  Also,
fix a stupid (probably?) typo in the "addhead" implementation,
too.  I've known about Array#reverse_each for a while...
Diffstat (limited to 'bin')
1 files changed, 2 insertions, 4 deletions
diff --git a/bin/dtas-tl b/bin/dtas-tl
index b682e2b..e375ff2 100755
--- a/bin/dtas-tl
+++ b/bin/dtas-tl
@@ -105,7 +105,7 @@ when "cat"
 when "addhead"
-  ARGV.reverse.each do |path|
+  ARGV.reverse_each do |path|
     path = File.expand_path(path)
     res = c.req(%W(tl add #{path}))
     print "#{path} #{res}\n"
@@ -114,13 +114,11 @@ when "addtail"
   track_ids = get_track_ids(c)
   last_id = track_ids.pop
-  ARGV.each do |path|
+  ARGV.reverse_each do |path|
     path = File.expand_path(path)
     req = %W(tl add #{path})
-    req << last_id.to_s if last_id
     res = c.req(req)
     print "#{path} #{res}\n"
-    last_id = res if res =~ /\A\d+\z/
 when "reto"
   fixed = ARGV.delete("-F")