on master help sign in
Hook `elm init` into terminal, shuffle output of `elm` help info
commita957144d283a24a9bdb7569d968b2943274dba5f authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 22 May 2018, 09:01 (8 years ago) parent4074a98
1 file changed+37−14
ui/terminal/src/Main.hs+37−14
ui/terminal/src/Main.hs+37−14
@@ -5,6 +5,7 @@ module Main
55 where
66
77
8+import Prelude hiding (init)
89import GHC.IO.Encoding (setLocaleEncoding, utf8)
910import qualified Data.List as List
1011import qualified Text.PrettyPrint.ANSI.Leijen as P
@@ -21,6 +22,7 @@ import Terminal.Args.Helpers
2122import qualified Bump
2223import qualified Develop
2324import qualified Diff
25+import qualified Init
2426import qualified Install
2527import qualified Make
2628import qualified Publish
@@ -36,6 +38,7 @@ main =
3638 do setLocaleEncoding utf8
3739 complex intro outro
3840 [ repl
41+ , init
3942 , reactor
4043 , make
4144 , install
@@ -71,6 +74,34 @@ outro =
7174
7275
7376
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+
74105-- REPL
75106
76107
@@ -78,8 +109,8 @@ repl :: Interface
78109repl =
79110 let
80111 summary =
81− "Open up an interactive programming session. You can type in Elm\
82− \ expressions and it will tell you what they evaluate to."
112+ "Open up an interactive programming session. Type in Elm expressions\
113+ \ like (2 + 2) or (String.length \"test\") and see if they equal four!"
83114
84115 details =
85116 "The `repl` command opens up an interactive programming session:"
@@ -117,8 +148,8 @@ reactor :: Interface
117148reactor =
118149 let
119150 summary =
120− "Easy way to get started with Elm. It shows a file viewer, and when you\
121− \ click on an Elm file, it compiles it and shows the result."
151+ "Compile code with a click. It opens a file viewer in your browser, and\
152+ \ when you click on an Elm file, it compiles and you see the result."
122153
123154 details =
124155 "The `reactor` command starts a local server on your computer:"
@@ -155,10 +186,6 @@ port_ =
155186make :: Interface
156187make =
157188 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−
162189 details =
163190 "The `make` command compiles Elm code into JS or HTML:"
164191
@@ -180,7 +207,7 @@ make =
180207 |-- 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!"
181208 |-- 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."
182209 in
183− Interface "make" (Common summary) details example (zeroOrMore elmFile) makeFlags Make.run
210+ Interface "make" Uncommon details example (zeroOrMore elmFile) makeFlags Make.run
184211
185212
186213
@@ -190,10 +217,6 @@ make =
190217install :: Interface
191218install =
192219 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−
197220 details =
198221 "The `install` command fetches packages from <https://package.elm-lang.org> for\
199222 \ use in your project:"
@@ -220,7 +243,7 @@ install =
220243 , require1 Install.Install package
221244 ]
222245 in
223− Interface "install" (Common summary) details example installArgs noFlags Install.run
246+ Interface "install" Uncommon details example installArgs noFlags Install.run
224247
225248
226249