From 9d287a37d5d893c87d0772a3b21b814cdfca43cf Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sun, 26 Nov 2023 20:53:31 -0800 Subject: [PATCH] Add flags for setting rules and query before starting Signed-off-by: Danila Fedorin --- index.html | 3 ++- src/Main.elm | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 2bd73a9..b95e86c 100644 --- a/index.html +++ b/index.html @@ -55,7 +55,8 @@ input[type="text"] { diff --git a/src/Main.elm b/src/Main.elm index 7d4e446..8df1b8d 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -18,13 +18,13 @@ type alias Model = { program : String , query : String } -type alias Flags = () +type alias Flags = { rules: String, query: String } type Msg = SetProgram String | SetQuery String init : Flags -> (Model, Cmd Msg) -init () = ({ program = "", query = "type(?e, tint)" }, Cmd.none) +init fs = ({ program = fs.rules, query = fs.query }, Cmd.none) viewSection : String -> Html Msg -> Html Msg viewSection name content = @@ -56,7 +56,7 @@ viewProofTree progs querys = viewSection "Proof Tree" <| view : Model -> Html Msg view m = Html.div [ class "elm-root" ] - [ viewSection "Rules" <| Html.textarea [ onInput SetProgram ] [] + [ viewSection "Rules" <| Html.textarea [ onInput SetProgram ] [ Html.text m.program ] , viewSection "Query" <| Html.input [ type_ "text", onInput SetQuery, value m.query ] [] , viewRules m.program , viewProofTree m.program m.query