commit:     ccfb2c3d3f4f78a21dd5f15a36450b89da8b8329
Author:     Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Mon Feb 23 00:04:43 2015 +0000
Commit:     Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Mon Feb 23 00:04:43 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=ccfb2c3d

Add id resolving helper

---
 lib/utils.rb | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/utils.rb b/lib/utils.rb
index 3714614..aaa04c7 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -14,5 +14,17 @@ module Ag
         'Encoding could not be reliably detected. Contents not available.'
       end
     end
+
+    def resolve_id
+      id = $options.dir
+      case $options.argmode
+      when :msgid
+        id = Ag::Storage.resolve_message_id($options.name, $options.dir)
+      when :file
+        id = Ag::Storage.resolve_filename($options.name, $options.dir)
+      end
+
+      id
+    end
   end
 end
\ No newline at end of file

Reply via email to