diff --git a/app/rofi-dev.hs b/app/rofi-dev.hs index 2607490..480e49e 100644 --- a/app/rofi-dev.hs +++ b/app/rofi-dev.hs @@ -37,17 +37,17 @@ makeHaskellTypesWith , MultipleConstructors "DataConfig" "(./dhall/rofi-dev.dhall).DataConfig" , SingleConstructor "TreeMap" "TreeMap" "(./dhall/rofi-dev.dhall).TreeMap" , SingleConstructor "SecretMap" "SecretMap" "(./dhall/rofi-dev.dhall).SecretMap" - , SingleConstructor "StaticConfig" "StaticConfig" "(./dhall/rofi-dev.dhall).StaticConfig" - , SingleConstructor "PromptConfig" "PromptConfig" "(./dhall/rofi-dev.dhall).PromptConfig" - , SingleConstructor "TreeConfig" "TreeConfig" "(./dhall/rofi-dev.dhall).TreeConfig" + , SingleConstructor "StaticConfig" "StaticConfig" "(./dhall/rofi-dev.dhall).StaticConfig.Type" + , SingleConstructor "PromptConfig" "PromptConfig" "(./dhall/rofi-dev.dhall).PromptConfig.Type" + , SingleConstructor "TreeConfig" "TreeConfig" "(./dhall/rofi-dev.dhall).TreeConfig.Type" , SingleConstructor "DeviceConfig" "DeviceConfig" "(./dhall/rofi-dev.dhall).DeviceConfig" , SingleConstructor "SecretConfig" "SecretConfig" "(./dhall/rofi-dev.dhall).SecretConfig" , SingleConstructor "MountConfig" "MountConfig" "(./dhall/rofi-dev.dhall).MountConfig" - , SingleConstructor "BitwardenConfig" "BitwardenConfig" "(./dhall/rofi-dev.dhall).BitwardenConfig" - , SingleConstructor "VeracryptData" "VeracryptData" "(./dhall/rofi-dev.dhall).VeracryptData" - , SingleConstructor "CIFSData" "CIFSData" "(./dhall/rofi-dev.dhall).CIFSData" - , SingleConstructor "CIFSOpts" "CIFSOpts" "(./dhall/rofi-dev.dhall).CIFSOpts" - , SingleConstructor "SSHFSData" "SSHFSData" "(./dhall/rofi-dev.dhall).SSHFSData" + , SingleConstructor "BitwardenConfig" "BitwardenConfig" "(./dhall/rofi-dev.dhall).BitwardenConfig.Type" + , SingleConstructor "VeracryptData" "VeracryptData" "(./dhall/rofi-dev.dhall).VeracryptData.Type" + , SingleConstructor "CIFSData" "CIFSData" "(./dhall/rofi-dev.dhall).CIFSData.Type" + , SingleConstructor "CIFSOpts" "CIFSOpts" "(./dhall/rofi-dev.dhall).CIFSOpts.Type" + , SingleConstructor "SSHFSData" "SSHFSData" "(./dhall/rofi-dev.dhall).SSHFSData.Type" ] main :: IO () diff --git a/dhall/rofi-dev.dhall b/dhall/rofi-dev.dhall index 06d49b2..0fb7d4d 100644 --- a/dhall/rofi-dev.dhall +++ b/dhall/rofi-dev.dhall @@ -1,51 +1,93 @@ let MountConfig = { mpPath : Text, mpLabel : Optional Text } -let BitwardenConfig = { bwKey : Text, bwTries : Natural } +let BitwardenConfig = + { Type = { bwKey : Text, bwTries : Natural }, default.bwTries = 3 } let SecretMap = { sKey : Text, sVal : Text } let SecretConfig = { secretAttributes : List SecretMap } -let PromptConfig = { promptTries : Natural } +let PromptConfig = { Type = { promptTries : Natural }, default.promptTries = 3 } let PasswordConfig = - < PwdBW : BitwardenConfig | PwdLS : SecretConfig | PwdPr : PromptConfig > + < PwdBW : BitwardenConfig.Type + | PwdLS : SecretConfig + | PwdPr : PromptConfig.Type + > -let SSHFSData = { sshfsRemote : Text, sshfsPassword : Optional PasswordConfig } +let SSHFSData = + { Type = { sshfsRemote : Text, sshfsPassword : Optional PasswordConfig } + , default.sshfsPassword = None PasswordConfig + } let CIFSOpts = - { cifsoptsUsername : Optional Text - , cifsoptsWorkgroup : Optional Text - , cifsoptsUID : Optional Natural - , cifsoptsGID : Optional Natural - , cifsoptsIocharset : Optional Text + { Type = + { cifsoptsUsername : Optional Text + , cifsoptsWorkgroup : Optional Text + , cifsoptsUID : Optional Natural + , cifsoptsGID : Optional Natural + , cifsoptsIocharset : Optional Text + } + , default = + { cifsoptsUsername = None Text + , cifsoptsWorkgroup = None Text + , cifsoptsUID = None Natural + , cifsoptsGID = None Natural + , cifsoptsIocharset = None Text + } } let CIFSData = - { cifsRemote : Text - , cifsSudo : Bool - , cifsPassword : Optional PasswordConfig - , cifsOpts : Optional CIFSOpts + { Type = + { cifsRemote : Text + , cifsSudo : Bool + , cifsPassword : Optional PasswordConfig + , cifsOpts : Optional CIFSOpts.Type + } + , default = + { cifsSudo = False + , cifsPassword = None PasswordConfig + , cifsOpts = CIFSOpts::{=} + } } -let VeracryptData = { vcVolume : Text, vcPassword : Optional PasswordConfig } +let VeracryptData = + { Type = + { vcVolume : Text + , vcPassword + {- TODO this shouldn't be optional -} + : Optional PasswordConfig + } + , default.vcPassword = None PasswordConfig + } let DataConfig = - < VeracryptConfig : VeracryptData - | SSHFSConfig : SSHFSData - | CIFSConfig : CIFSData + < VeracryptConfig : VeracryptData.Type + | SSHFSConfig : SSHFSData.Type + | CIFSConfig : CIFSData.Type > let DeviceConfig = { deviceMount : MountConfig, deviceData : DataConfig } -let TreeConfig = { tcParent : DeviceConfig, tcChildren : List Text } +let TreeConfig = + { Type = { tcParent : DeviceConfig, tcChildren : List Text } + , default.tcChildren = [] : List Text + } -let TreeMap = { tKey : Text, tVal : TreeConfig } +let TreeMap = { tKey : Text, tVal : TreeConfig.Type } let StaticConfig = - { scTmpPath : Optional Text - , scVerbose : Optional Bool - , scDevices : List TreeMap + { Type = + { scTmpPath : Optional Text + , scVerbose : Optional Bool + , scDevices : List TreeMap + } + , default = + { scTmpPath = + {- defaults to /tmp/media/{username} -} + None Text + , scVerbose = Some False + } } in { StaticConfig