Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clean-sapl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
clean-sapl
Commits
50550928
Verified
Commit
50550928
authored
Jun 19, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nuke --beautify and --output options
parent
02c7299a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
36 deletions
+2
-36
src/saplcg.icl
src/saplcg.icl
+2
-36
No files found.
src/saplcg.icl
View file @
50550928
module
saplcg
import
StdBool
import
StdFile
import
StdList
import
StdString
import
StdTuple
import
Data
.
Error
from
Data
.
Func
import
$,
mapSt
,
seqSt
from
Data
.
Map
import
fromList
,
newMap
import
Data
.
Maybe
import
System
.
CommandLine
import
System
.
Environment
import
System
.
File
import
System
.
FilePath
import
System
.
Options
import
System
.
Process
import
Text
import
Sapl
.
Target
.
CleanFlavour
...
...
@@ -27,8 +20,6 @@ import Sapl.Target.JS.CodeGeneratorJS
,
libraries
::
![
String
]
,
modules
::
![
String
]
,
trampoline
::
!
Bool
,
output
::
!
Maybe
FilePath
,
beautify
::
!
Maybe
FilePath
}
defaultOptions
::
Options
...
...
@@ -38,8 +29,6 @@ defaultOptions =
,
libraries
=
[
"StdEnv"
]
,
modules
=
[]
,
trampoline
=
False
,
output
=
Nothing
,
beautify
=
Nothing
}
defaultParserState
::
ParserState
...
...
@@ -57,7 +46,7 @@ defaultParserState =
Start
w
#
([
prog
:
args
],
w
)
=
getCommandLine
w
#
noUsage
=
Nothing
#
usage
=
Just
(
"Usage: "
+++
prog
+++
" [OPTIONS]
-o OUTPUT
MOD [MOD..]"
)
#
usage
=
Just
(
"Usage: "
+++
prog
+++
" [OPTIONS] MOD [MOD..]"
)
#
opts
=
defaultOptions
#
(
home
,
w
)
=
getEnvironmentVariable
"CLEAN_HOME"
w
...
...
@@ -66,27 +55,14 @@ Start w
#
opts
=
fromOk
opts
|
isEmpty
opts
.
modules
=
error
usage
"No modules given"
w
|
isNothing
opts
.
output
=
error
usage
"No output file given"
w
|
isNothing
opts
.
output
&&
isJust
opts
.
beautify
=
error
Nothing
"Cannot use beautifier when outputting to stdout"
w
#
(
files
,(
pst
,
w
))
=
mapSt
(
parseModule
opts
)
opts
.
modules
(
defaultParserState
,
w
)
|
any
isNothing
files
=
error
Nothing
"Parsing failed"
w
#
(
ok
,
out
,
w
)
=
case
opts
.
output
of
Nothing
->
let
(
f
,
w`
)
=
stdio
w
in
(
True
,
f
,
w`
)
Just
o
->
fopen
o
FWriteText
w
#
(
out
,
w
)
=
stdio
w
#
(
out
,_,
w
)
=
seqSt
(
genCode
opts
)
[
f
\\
Just
f
<-
files
]
(
out
,
pst
,
w
)
#
(_,
w
)
=
fclose
out
w
#
w
=
case
opts
.
beautify
of
Nothing
->
w
Just
beautify
#
(
err
,
w
)
=
callProcess
beautify
[
out
,
"-o"
,
out
]
Nothing
w
with
out
=
fromJust
opts
.
output
|
isError
err
->
error
Nothing
(
"Error while beautifying: "
+++
snd
(
fromError
err
))
w
->
w
=
w
where
optionDescription
::
Option
Options
...
...
@@ -110,16 +86,6 @@ where
"--trampoline"
(\
opts
->
Ok
{
opts
&
trampoline
=
True
})
"Turn on trampoline code"
,
Shorthand
"-b"
"--beautify"
$
Option
"--beautify"
(\
b
opts
->
Ok
{
opts
&
beautify
=
Just
b
})
"PROG"
"Name or path of a JavaScript beautifier"
,
Shorthand
"-o"
"--output"
$
Option
"--output"
(\
f
opts
->
Ok
{
opts
&
output
=
Just
f
})
"OUTPUT"
"File to write output to"
,
Operand
False
(\
m
opts
->
Just
$
Ok
{
opts
&
modules
=
opts
.
modules
++
[
m
]})
"MODULE"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment