begin type interop

This commit is contained in:
mtgmonkey 2025-05-04 13:11:51 -04:00
parent 6c4557289b
commit c86f613ccc
6 changed files with 94 additions and 3 deletions

View file

@ -185,6 +185,7 @@ update msg model =
type Command
= Help
| Clear
| Colors
| Cookies
| FontCommand
| Hello
@ -213,6 +214,9 @@ parseInput input =
Just "clear" ->
Ok Clear
Just "colors" ->
Ok Colors
Just "cookies" ->
Ok Cookies
@ -269,6 +273,9 @@ runCommand model input =
Clear ->
runClear
Colors ->
runColors
Cookies ->
runCookies
@ -341,6 +348,9 @@ runHelp model args =
[ text <| "\nclear clears the screen"
]
Just "colors" ->
[ text "\ncolors ", coloredText (coreColor BrightCyan) "[UNIMPLEMENTED]" ]
Just "cookies" ->
[ text <|
"\ncookies prints info about the current cookie settings"
@ -407,6 +417,25 @@ runClear model args =
)
runColors : CommandRunner
runColors model args =
case List.head args of
Nothing ->
( { model | content = model.content ++ wrongArgs Colors 1 args }, Cmd.none )
Just "test" ->
( { model
| content =
model.content
++ [ coloredText (coreColor Red) "Red" ]
}
, Cmd.none
)
Just _ ->
( { model | content = model.content ++ wrongArgs Colors 1 args }, Cmd.none )
runCookies : CommandRunner
runCookies model args =
case List.head args of
@ -669,6 +698,7 @@ runTodo model args =
++ "\n- Something like Neofetch"
++ "\n- Collect and store feedback in a database"
++ "\n- Create a style guide for programs involving console colors"
++ "\n- Modularise the code (to have something more elegant than a single 2k line file)"
++ "\n"
++ "\nUpcoming commands to look forward to:"
++ "\nfunfetch"
@ -710,6 +740,9 @@ wrongArgs command expected args =
Clear ->
"clear"
Colors ->
"colors"
Cookies ->
"cookies"
@ -941,6 +974,37 @@ type ThemeColor
| BrightWhite
allColors : Model -> List Color
allColors model =
List.map
coreColor
[ Red
, Green
, Yellow
, Blue
, Magenta
, Cyan
, BrightRed
, BrightGreen
, BrightYellow
, BrightBlue
, BrightMagenta
, BrightCyan
]
++
List.map
(themeColor model)
[ Background
, Foreground
, Cursor
, Black
, White
, BrightBlack
, BrightWhite
]
-- Colors from Root Loops
-- flavor: intense