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" , MultipleConstructors "DataConfig" "(./dhall/rofi-dev.dhall).DataConfig"
, SingleConstructor "TreeMap" "TreeMap" "(./dhall/rofi-dev.dhall).TreeMap" , SingleConstructor "TreeMap" "TreeMap" "(./dhall/rofi-dev.dhall).TreeMap"
, SingleConstructor "SecretMap" "SecretMap" "(./dhall/rofi-dev.dhall).SecretMap" , SingleConstructor "SecretMap" "SecretMap" "(./dhall/rofi-dev.dhall).SecretMap"
, SingleConstructor "StaticConfig" "StaticConfig" "(./dhall/rofi-dev.dhall).StaticConfig" , SingleConstructor "StaticConfig" "StaticConfig" "(./dhall/rofi-dev.dhall).StaticConfig.Type"
, SingleConstructor "PromptConfig" "PromptConfig" "(./dhall/rofi-dev.dhall).PromptConfig" , SingleConstructor "PromptConfig" "PromptConfig" "(./dhall/rofi-dev.dhall).PromptConfig.Type"
, SingleConstructor "TreeConfig" "TreeConfig" "(./dhall/rofi-dev.dhall).TreeConfig" , SingleConstructor "TreeConfig" "TreeConfig" "(./dhall/rofi-dev.dhall).TreeConfig.Type"
, SingleConstructor "DeviceConfig" "DeviceConfig" "(./dhall/rofi-dev.dhall).DeviceConfig" , SingleConstructor "DeviceConfig" "DeviceConfig" "(./dhall/rofi-dev.dhall).DeviceConfig"
, SingleConstructor "SecretConfig" "SecretConfig" "(./dhall/rofi-dev.dhall).SecretConfig" , SingleConstructor "SecretConfig" "SecretConfig" "(./dhall/rofi-dev.dhall).SecretConfig"
, SingleConstructor "MountConfig" "MountConfig" "(./dhall/rofi-dev.dhall).MountConfig" , SingleConstructor "MountConfig" "MountConfig" "(./dhall/rofi-dev.dhall).MountConfig"
, SingleConstructor "BitwardenConfig" "BitwardenConfig" "(./dhall/rofi-dev.dhall).BitwardenConfig" , SingleConstructor "BitwardenConfig" "BitwardenConfig" "(./dhall/rofi-dev.dhall).BitwardenConfig.Type"
, SingleConstructor "VeracryptData" "VeracryptData" "(./dhall/rofi-dev.dhall).VeracryptData" , SingleConstructor "VeracryptData" "VeracryptData" "(./dhall/rofi-dev.dhall).VeracryptData.Type"
, SingleConstructor "CIFSData" "CIFSData" "(./dhall/rofi-dev.dhall).CIFSData" , SingleConstructor "CIFSData" "CIFSData" "(./dhall/rofi-dev.dhall).CIFSData.Type"
, SingleConstructor "CIFSOpts" "CIFSOpts" "(./dhall/rofi-dev.dhall).CIFSOpts" , SingleConstructor "CIFSOpts" "CIFSOpts" "(./dhall/rofi-dev.dhall).CIFSOpts.Type"
, SingleConstructor "SSHFSData" "SSHFSData" "(./dhall/rofi-dev.dhall).SSHFSData" , SingleConstructor "SSHFSData" "SSHFSData" "(./dhall/rofi-dev.dhall).SSHFSData.Type"
] ]
main :: IO () main :: IO ()

View File

@ -1,51 +1,93 @@
let MountConfig = { mpPath : Text, mpLabel : Optional Text } 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 SecretMap = { sKey : Text, sVal : Text }
let SecretConfig = { secretAttributes : List SecretMap } let SecretConfig = { secretAttributes : List SecretMap }
let PromptConfig = { promptTries : Natural } let PromptConfig = { Type = { promptTries : Natural }, default.promptTries = 3 }
let PasswordConfig = 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 = let CIFSOpts =
{ cifsoptsUsername : Optional Text { Type =
, cifsoptsWorkgroup : Optional Text { cifsoptsUsername : Optional Text
, cifsoptsUID : Optional Natural , cifsoptsWorkgroup : Optional Text
, cifsoptsGID : Optional Natural , cifsoptsUID : Optional Natural
, cifsoptsIocharset : Optional Text , cifsoptsGID : Optional Natural
, cifsoptsIocharset : Optional Text
}
, default =
{ cifsoptsUsername = None Text
, cifsoptsWorkgroup = None Text
, cifsoptsUID = None Natural
, cifsoptsGID = None Natural
, cifsoptsIocharset = None Text
}
} }
let CIFSData = let CIFSData =
{ cifsRemote : Text { Type =
, cifsSudo : Bool { cifsRemote : Text
, cifsPassword : Optional PasswordConfig , cifsSudo : Bool
, cifsOpts : Optional CIFSOpts , 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 = let DataConfig =
< VeracryptConfig : VeracryptData < VeracryptConfig : VeracryptData.Type
| SSHFSConfig : SSHFSData | SSHFSConfig : SSHFSData.Type
| CIFSConfig : CIFSData | CIFSConfig : CIFSData.Type
> >
let DeviceConfig = { deviceMount : MountConfig, deviceData : DataConfig } 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 = let StaticConfig =
{ scTmpPath : Optional Text { Type =
, scVerbose : Optional Bool { scTmpPath : Optional Text
, scDevices : List TreeMap , scVerbose : Optional Bool
, scDevices : List TreeMap
}
, default =
{ scTmpPath =
{- defaults to /tmp/media/{username} -}
None Text
, scVerbose = Some False
}
} }
in { StaticConfig in { StaticConfig