summaryrefslogtreecommitdiff
path: root/Utility/Gpg/Types.hs
blob: d457072074c280e41a400c466bcfbe4d8a36f08c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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