Skip to content

Commit

Permalink
Merge pull request #489 from BinderDavid/add-cabal-to-list
Browse files Browse the repository at this point in the history
Prepare the error message index for cabal
  • Loading branch information
BinderDavid authored Jun 6, 2024
2 parents cc1f169 + 161d8e0 commit 2c280d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Today, the Haskell Message Index supports three tools. Any user-facing Haskell-r
| GHC | 9.6.1 | `GHC-` |
| Stack | 2.9.3 | `S-` |
| GHCup | 0.1.19.0 | `GHCup-` |
| Cabal | 3.12 | `Cabal-` |

## Contributing to the Message Index

Expand Down
7 changes: 5 additions & 2 deletions message-index/create-message-template.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ normalize = fmap toLower . strip

-- Querying for the tool: GHC / GHCup / Stack

data Tool = GHC | GHCup | Stack deriving (Show)
data Tool = GHC | GHCup | Stack | Cabal deriving (Show)

readTool :: IO Tool
readTool = do
putStrLn "· Which tool's error code do you want to document?"
putStrLn " 1) GHC"
putStrLn " 2) GHCup"
putStrLn " 3) Stack"
putStrLn " 4) Cabal"
putStr "Input (Default = GHC): "
ln <- getLine
case normalize ln of
Expand All @@ -44,6 +45,8 @@ readTool = do
"ghcup" -> pure GHCup
"3" -> pure Stack
"stack" -> pure Stack
"4" -> pure Cabal
"cabal" -> pure Cabal
"" -> pure GHC
_ -> do
putStrLn "Didn't understand input. Please type a tool name or a number."
Expand Down Expand Up @@ -202,7 +205,7 @@ createFiles tmpl = do
putStrLn "· Creating scaffolding..."

-- Create the new directory "messages/XXX-NNNNNN/" and "messages/XXX-NNNNNN/index.md"
let message_dir = "messages" </> case tool tmpl of { GHC -> "GHC-"; GHCup -> "GHCup-"; Stack -> "S-" } ++ code tmpl
let message_dir = "messages" </> case tool tmpl of { GHC -> "GHC-"; GHCup -> "GHCup-"; Stack -> "S-"; Cabal -> "Cabal-" } ++ code tmpl
createDirectoryIfMissing True message_dir
let index_filename = message_dir </> "index.md"
let toplvl_index =
Expand Down
1 change: 1 addition & 0 deletions test/create-message-template/golden1.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ You can leave any of the text fields blank and fill them in by hand later.
1) GHC
2) GHCup
3) Stack
4) Cabal
Input (Default = GHC):
· What is the numeric code that you want to document?
For example, enter "01234" if you want to document GHC-01234.
Expand Down

0 comments on commit 2c280d5

Please sign in to comment.