summaryrefslogtreecommitdiff
path: root/Utility/Gpg/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Utility/Gpg/Types.hs')
-rw-r--r--Utility/Gpg/Types.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/Utility/Gpg/Types.hs b/Utility/Gpg/Types.hs
new file mode 100644
index 000000000..d45707207
--- /dev/null
+++ b/Utility/Gpg/Types.hs
@@ -0,0 +1,30 @@
+{- gpg data types
+ -
+ - Copyright 2013 guilhem <guilhem@fripost.org>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Utility.Gpg.Types where
+
+import Utility.SafeCommand
+import Types.GitConfig
+import Types.Remote
+
+{- GnuPG options. -}
+type GpgOpt = String
+newtype GpgOpts = GpgOpts [GpgOpt]
+
+toParams :: GpgOpts -> [CommandParam]
+toParams (GpgOpts opts) = map Param opts
+
+class LensGpgOpts a where
+ getGpgOpts :: a -> GpgOpts
+
+{- Extract the GnuPG options from a Remote Git Config. -}
+instance LensGpgOpts RemoteGitConfig where
+ getGpgOpts = GpgOpts . remoteAnnexGnupgOptions
+
+{- Extract the GnuPG options from a Remote. -}
+instance LensGpgOpts (RemoteA a) where
+ getGpgOpts = getGpgOpts . gitconfig