{-| Common utilities for @dhall-docs@ -}
module Dhall.Docs.Util where

import Data.Text (Text)

import qualified Data.Text

-- | If you're wondering the GitHub query params for issue creation:
-- https://docs.github.com/en/github/managing-your-work-on-github/about-automation-for-issues-and-pull-requests-with-query-parameters
fileAnIssue :: Text -> a
fileAnIssue :: Text -> a
fileAnIssue Text
titleName =
    [Char] -> a
forall a. HasCallStack => [Char] -> a
error ([Char] -> a) -> [Char] -> a
forall a b. (a -> b) -> a -> b
$ [Char]
"\ESC[1;31mError\ESC[0m Documentation generator bug\n\n" [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>

            [Char]
"Explanation: This error message means that there is a bug in the " [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>
            [Char]
"Dhall Documentation generator. You didn't did anything wrong, but " [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>
            [Char]
"if you would like to see this problem fixed then you should report " [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>
            [Char]
"the bug at:\n\n" [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>

            [Char]
"https://github.com/dhall-lang/dhall-haskell/issues/new?labels=dhall-docs,bug\n\n" [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>

            [Char]
"explaining your issue and add \"" [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<> Text -> [Char]
Data.Text.unpack Text
titleName [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<> [Char]
"\" as error code " [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>
            [Char]
"so we can find the proper location in the source code where the error happened\n\n" [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>

            [Char]
"Please, also include your package in the issue. It can be in:\n\n" [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>
            [Char]
"* A compressed archive (zip, tar, etc)\n" [Char] -> [Char] -> [Char]
forall a. Semigroup a => a -> a -> a
<>
            [Char]
"* A git repository, preferably with a commit reference"