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-test
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-test
Commits
eb9c25f1
Commit
eb9c25f1
authored
Feb 08, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial argument parsing
parent
6571ac8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletion
+66
-1
.gitignore
.gitignore
+1
-0
Tools/CleanTest.icl
Tools/CleanTest.icl
+65
-1
No files found.
.gitignore
0 → 100644
View file @
eb9c25f1
Clean System Files/
Tools/CleanTest.icl
View file @
eb9c25f1
module
CleanTest
Start
=
"Placeholder..."
// Build with -nr -nt -nortsopts
import
StdFile
import
StdList
import
StdString
import
Data
.
Error
from
Data
.
Func
import
$
import
Data
.
Generics
.
GenDefault
import
Data
.
Maybe
import
System
.
CommandLine
import
System
.
FilePath
::
Options
=
{
runs
::
[
Run
]
,
help
::
Bool
}
::
Run
=
{
executable
::
FilePath
,
options
::
[
String
]
}
gDefault
{|
Bool
|}
=
False
derive
gDefault
Options
,
Run
Start
w
#
([
prog
:
args
],
w
)
=
getCommandLine
w
#
opts
=
parseOpts
gDefault
{|*|}
args
|
isError
opts
=
exit
True
(
Just
$
fromError
opts
)
prog
w
#
opts
=
fromOk
opts
|
opts
.
help
=
exit
True
Nothing
prog
w
=
w
where
parseOpts
::
Options
[
String
]
->
MaybeErrorString
Options
parseOpts
opts
[]
=
Ok
{
opts
&
runs
=
reverse
opts
.
runs
}
parseOpts
opts
[
"--run"
:
args
]
=
parseOpts
opts
[
"-r"
:
args
]
parseOpts
opts
[
"-r"
:
exe
:
args
]
=
parseOpts
{
opts
&
runs
=[
new
:
opts
.
runs
]}
args
with
new
=
{
gDefault
{|*|}
&
executable
=
exe
}
parseOpts
opts
[
"-r"
]
=
Error
"-r requires a parameter"
parseOpts
opts
[
"--help"
:
args
]
=
parseOpts
opts
[
"-h"
:
args
]
parseOpts
opts
[
"-h"
:
args
]
=
parseOpts
{
opts
&
help
=
True
}
args
parseOpts
opts
[
"--option"
:
args
]
=
parseOpts
opts
[
"-O"
:
args
]
parseOpts
opts
[
"-O"
:
opt
:
args
]
=
case
opts
.
runs
of
[]
->
Error
"-O used before -r"
[
r
:
rs
]
->
parseOpts
{
opts
&
runs
=[{
r
&
options
=
r
.
options
++
[
opt
]}:
rs
]}
args
parseOpts
opts
[
"-O"
]
=
Error
"-O requires a parameter"
parseOpts
opts
[
arg
:
args
]
=
Error
$
"Unknown argument '"
+++
arg
+++
"'"
exit
::
Bool
(
Maybe
String
)
String
*
World
->
*
World
exit
show_help
error
prog
w
#
io
=
stderr
#
io
=
io
<<<
case
error
of
Just
e
->
"Error: "
+++
e
+++
if
show_help
".
\n\n
"
".
\n
"
Nothing
->
""
#
io
=
if
show_help
(
io
<<<
help
)
io
#
(_,
w
)
=
fclose
io
w
#
w
=
setReturnCode
(
if
(
isNothing
error
)
0
1
)
w
=
w
where
help
::
String
help
=
prog
+++
": run Clean tests
\n
Options:
\n
"
+++
" --help/-h Show this help
\n
"
+++
" --run/-r EXE Execute tests from executable EXE
\n
"
+++
" --option/-O OPT Add OPT to the command line of the previously added run
\n
"
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