ENH update dhall types

This commit is contained in:
Nathan Dwarshuis 2024-08-09 10:45:11 -04:00
parent 5a9f421dcb
commit 7ed00c0987
2 changed files with 72 additions and 30 deletions

View File

@ -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 ()

View File

@ -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