aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Legler <alex@a3li.li>2015-02-23 01:04:43 +0100
committerAlex Legler <alex@a3li.li>2015-02-23 01:04:43 +0100
commitccfb2c3d3f4f78a21dd5f15a36450b89da8b8329 (patch)
tree2c8b3777316eea631d43d551c985c4bc767d5755 /lib
parentRefactor id resolving method to a more generic function (diff)
downloadbackend-ccfb2c3d3f4f78a21dd5f15a36450b89da8b8329.tar.gz
backend-ccfb2c3d3f4f78a21dd5f15a36450b89da8b8329.tar.bz2
backend-ccfb2c3d3f4f78a21dd5f15a36450b89da8b8329.zip
Add id resolving helper
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.rb12
1 files changed, 12 insertions, 0 deletions
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