-
Notifications
You must be signed in to change notification settings - Fork 2
/
elm-new.bat
94 lines (60 loc) · 1.82 KB
/
elm-new.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@echo off
setlocal EnableDelayedExpansion
set choice=default
set dest=.
set synopsis=^
Usage: elm-new [PATH] [OPTIONS]^
Creates a new project with the specified options. The default is Browser.document.^
^
Options:^
-b --beginner Create a Browser.sandbox^
--hello-world Create a "Hello, world!" program^
--navigation Create a Browser.application^
-h --help Show this help text^
-V --version Print version^
^
Examples^
elm-new Create a Browser.document in the current directory^
elm-new my-project Create a Browser.document in my-project/^
elm-new my-project --beginner Create a Browser.sandbox in my-project/^
elm-new my-spa --navigation Create a Browser.application in my-spa/^
elm-new hello --hello-world Create a `Hello world` program in hello/
for %%a in (%*) do (
set arg=%%a
if %%a == --help (
echo !synopsis!
exit /b
) else if %%a == -h (
echo !synopsis!
exit /b
) else if %%a == --version (
echo 2.0.0
exit /b
) else if %%a == -V (
echo 2.0.0
exit /b
) else if %%a == --beginner (
set choice=beginner
) else if %%a == -b (
set choice=beginner
) else if %%a == --hello-world (
set choice=hello-world
) else if %%a == --navigation (
set choice=navigation
) else if "!arg:~0,1!" == "-" (
echo elm-new: illegal option !arg! 1>&2
echo !synopsis!
exit /b 1
) else (
set dest=%%a
)
)
robocopy %~dp0\share\elm-new\%choice% "%dest%" /e >nul 2>&1
echo Your Elm program has been created successfully.
echo.
echo You can use "elm make" to compile it:
echo.
echo elm make src/Main.elm
echo.
echo Run "elm" for more commands.
exit /b