From f8d1f39f679cc9af195df3e0ecd9cf58642b2122 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Mon, 4 Jun 2012 22:38:15 +0200 Subject: [PATCH] Allow comments at start of file, before access line --- pws | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pws b/pws index 827a678..3790b4f 100755 --- a/pws +++ b/pws @@ -410,10 +410,14 @@ class EncryptedFile end def EncryptedFile.targets(text) - metaline = text.split("\n").first - m = /^access: (.*)/.match metaline - return [] unless m - return m[1].strip.split(/[\t ,]+/) + text.split("\n").each do |line| + if /^#/.match line + next + end + m = /^access: (.*)/.match line + return [] unless m + return m[1].strip.split(/[\t ,]+/) + end end -- 2.39.5