on master help sign in
Hook `elm init` into terminal, shuffle output of `elm` help info
a957144Evan Czaplicki
ui/terminal/src/Main.hs+37−14
@@ -5,6 +5,7 @@ module Main
5 where
5 where
6
6
7
7
8+import Prelude hiding (init)
8import GHC.IO.Encoding (setLocaleEncoding, utf8)
9import GHC.IO.Encoding (setLocaleEncoding, utf8)
9import qualified Data.List as List
10import qualified Data.List as List
10import qualified Text.PrettyPrint.ANSI.Leijen as P
11import qualified Text.PrettyPrint.ANSI.Leijen as P
@@ -21,6 +22,7 @@ import Terminal.Args.Helpers
21import qualified Bump
22import qualified Bump
22import qualified Develop
23import qualified Develop
23import qualified Diff
24import qualified Diff
25+import qualified Init
24import qualified Install
26import qualified Install
25import qualified Make
27import qualified Make
26import qualified Publish
28import qualified Publish
@@ -36,6 +38,7 @@ main =
36 do setLocaleEncoding utf8
38 do setLocaleEncoding utf8
37 complex intro outro
39 complex intro outro
38 [ repl
40 [ repl
41+ , init
39 , reactor
42 , reactor
40 , make
43 , make
41 , install
44 , install
@@ -71,6 +74,34 @@ outro =
71
74
72
75
73
76
77+-- INIT
78+
79+
80+init :: Interface
81+init =
82+ let
83+ summary =
84+ "Start an Elm project. It creates two files (elm.json and src/Main.elm)\
85+ \ and provides a couple links that explain how to get going with Elm."
86+
87+ details =
88+ "The `init` command helps start Elm projects:"
89+
90+ example =
91+ reflow
92+ "It asks permission to create two files (elm.json and src/Main.elm) that are\
93+ \ common to all Elm projects. It also provides a couple links that explain what\
94+ \ to do from there."
95+
96+ initFlags =
97+ flags Init.Flags
98+ |-- onOff "embed" "Switch Browser.sandbox to Browser.embed, making it easier to jump into making HTTP requests, generating random values, asking the time, etc."
99+ |-- onOff "fullscreen" "Switch Browser.sandbox to Browser.fullscreen, setting you up for a single-page app that controls the <title> and URL of the browser."
100+ in
101+ Interface "init" (Common summary) details example noArgs initFlags Init.run
102+
103+
104+
74-- REPL
105-- REPL
75
106
76
107
@@ -78,8 +109,8 @@ repl :: Interface
78repl =
109repl =
79 let
110 let
80 summary =
111 summary =
81− "Open up an interactive programming session. You can type in Elm\
112+ "Open up an interactive programming session. Type in Elm expressions\
82− \ expressions and it will tell you what they evaluate to."
113+ \ like (2 + 2) or (String.length \"test\") and see if they equal four!"
83
114
84 details =
115 details =
85 "The `repl` command opens up an interactive programming session:"
116 "The `repl` command opens up an interactive programming session:"
@@ -117,8 +148,8 @@ reactor :: Interface
117reactor =
148reactor =
118 let
149 let
119 summary =
150 summary =
120− "Easy way to get started with Elm. It shows a file viewer, and when you\
151+ "Compile code with a click. It opens a file viewer in your browser, and\
121− \ click on an Elm file, it compiles it and shows the result."
152+ \ when you click on an Elm file, it compiles and you see the result."
122
153
123 details =
154 details =
124 "The `reactor` command starts a local server on your computer:"
155 "The `reactor` command starts a local server on your computer:"
@@ -155,10 +186,6 @@ port_ =
155make :: Interface
186make :: Interface
156make =
187make =
157 let
188 let
158− summary =
159− "Compile files by hand. Once you get comfortable with Elm projects, you\
160− \ will probably want this level of control during development."
161−
162 details =
189 details =
163 "The `make` command compiles Elm code into JS or HTML:"
190 "The `make` command compiles Elm code into JS or HTML:"
164
191
@@ -180,7 +207,7 @@ make =
180 |-- flag "report" Make.reportType "You can say --report=json to get error messages as JSON. This is only really useful if you are an editor plugin. Humans should avoid it!"
207 |-- flag "report" Make.reportType "You can say --report=json to get error messages as JSON. This is only really useful if you are an editor plugin. Humans should avoid it!"
181 |-- flag "docs" Make.docsFile "Generate a JSON file of documentation for a package. Eventually it will be possible to preview docs with `reactor` because it is quite hard to deal with these JSON files directly."
208 |-- flag "docs" Make.docsFile "Generate a JSON file of documentation for a package. Eventually it will be possible to preview docs with `reactor` because it is quite hard to deal with these JSON files directly."
182 in
209 in
183− Interface "make" (Common summary) details example (zeroOrMore elmFile) makeFlags Make.run
210+ Interface "make" Uncommon details example (zeroOrMore elmFile) makeFlags Make.run
184
211
185
212
186
213
@@ -190,10 +217,6 @@ make =
190install :: Interface
217install :: Interface
191install =
218install =
192 let
219 let
193− summary =
194− "Install <https://package.elm-lang.org> packages. Every project is\
195− \ independent, so you can use different versions in different projects."
196−
197 details =
220 details =
198 "The `install` command fetches packages from <https://package.elm-lang.org> for\
221 "The `install` command fetches packages from <https://package.elm-lang.org> for\
199 \ use in your project:"
222 \ use in your project:"
@@ -220,7 +243,7 @@ install =
220 , require1 Install.Install package
243 , require1 Install.Install package
221 ]
244 ]
222 in
245 in
223− Interface "install" (Common summary) details example installArgs noFlags Install.run
246+ Interface "install" Uncommon details example installArgs noFlags Install.run
224
247
225
248
226
249