unsafePOSIXTimeFromString :: String -> NominalDiffTime
unsafePOSIXTimeFromString str =
    case parseTimeM True defaultTimeLocale "%s" str of
        Nothing ->
            error $ "Tried to convert a 'String' to a 'NominalDiffTime' but failed: " <> toText str

        Just b ->
            utcTimeToPOSIXSeconds b


-- * ENV var <--> CLI args

-- We want to comprehend any ENVironment variables as if they were CLI
-- arguments and flags, such that we can re-use code to parse them and build
-- **Args structure from them.
--
-- The tricky thing here is that ENVironment "flags" don't exist so to speak,
-- so we have to reflect on the opt-applicative@Parser to see whether we expect
-- a var to be an 'Arg' or 'Flag'. If we expect a 'Flag' then the underlying
-- ENV var should be set to 'True' or 'False'
--
-- This also makes sure that we don't forget any CLI args and that's why, we
-- need to setup a full ENVironment before we actually start parsing. If one
-- variable is missing, it will throw a great deal.
unsafePOSIXTimeFromString :: String -> NominalDiffTime
unsafePOSIXTimeFromString str =
    case parseTimeM True defaultTimeLocale "%s" str of
        Nothing ->
            error $ "Tried to convert a 'String' to a 'NominalDiffTime' but failed: " <> toText str

        Just b ->
            utcTimeToPOSIXSeconds b


-- * ENV var <--> CLI args

-- We want to comprehend any ENVironment variables as if they were CLI
-- arguments and flags, such that we can re-use code to parse them and build
-- **Args structure from them.
--
-- The tricky thing here is that ENVironment "flags" don't exist so to speak,
-- so we have to reflect on the opt-applicative@Parser to see whether we expect
-- a var to be an 'Arg' or 'Flag'. If we expect a 'Flag' then the underlying
-- ENV var should be set to 'True' or 'False'
--
-- This also makes sure that we don't forget any CLI args and that's why, we
-- need to setup a full ENVironment before we actually start parsing. If one
-- variable is missing, it will throw a great deal.
unsafePOSIXTimeFromString str =
    case parseTimeM True defaultTimeLocale "%s" str of
        Nothing ->
            error $ "Tried to convert a 'String' to a 'NominalDiffTime' but failed: " <> toText str

        Just b ->
            utcTimeToPOSIXSeconds b


-- * ENV var <--> CLI args

-- We want to comprehend any ENVironment variables as if they were CLI
-- arguments and flags, such that we can re-use code to parse them and build
-- **Args structure from them.
--
-- The tricky thing here is that ENVironment "flags" don't exist so to speak,
-- so we have to reflect on the opt-applicative@Parser to see whether we expect
-- a var to be an 'Arg' or 'Flag'. If we expect a 'Flag' then the underlying
-- ENV var should be set to 'True' or 'False'
--
-- This also makes sure that we don't forget any CLI args and that's why, we
-- need to setup a full ENVironment before we actually start parsing. If one
-- variable is missing, it will throw a great deal.