Skip to content

Commit

Permalink
enable autocompletion for the --theme flag
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Sep 6, 2022
1 parent 1fdc367 commit 1a9e7ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/Commands/Html.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ parseHtml = do
<> value Ayu
<> showDefault
<> help "selects a theme: ayu (light); nord (dark)"
<> completeWith (map show allThemes)
)
_htmlOutputDir <-
option
Expand All @@ -46,8 +47,10 @@ parseHtml = do
)
pure HtmlOptions {..}
where
allThemes :: [Theme]
allThemes = allElements
parseTheme :: String -> Either String Theme
parseTheme s = case s of
parseTheme s = case map toLower s of
"nord" -> Right Nord
"ayu" -> Right Ayu
_ -> Left $ "unrecognised theme: " <> s
2 changes: 1 addition & 1 deletion src/Juvix/Compiler/Backend/Html/Data/Theme.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Juvix.Prelude
data Theme
= Nord
| Ayu
deriving stock (Show)
deriving stock (Show, Enum, Bounded)

data HtmlKind
= HtmlDoc
Expand Down

0 comments on commit 1a9e7ff

Please sign in to comment.