Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
ghc-geode
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projet GEODE
ghc-geode
Compare revisions
caf789dc8bfe3c08bca3fa28485dd09e9143d4c8 to a5c32cfae40a9b90e6727d6fae215c2dee437cd5
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
geode/ghc-geode
Select target project
No results found
a5c32cfae40a9b90e6727d6fae215c2dee437cd5
Select Git revision
Swap
Target
geode/ghc-geode
Select target project
geode/ghc-geode
1 result
caf789dc8bfe3c08bca3fa28485dd09e9143d4c8
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Use the official implementation for NonEmpty which I discovered afterwards
· 9802e63c
Alice Brenon
authored
1 year ago
9802e63c
Expose the xmlOutput parser separately
· a5c32cfa
Alice Brenon
authored
1 year ago
a5c32cfa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/GEODE/Options.hs
+18
-17
18 additions, 17 deletions
lib/GEODE/Options.hs
with
18 additions
and
17 deletions
lib/GEODE/Options.hs
View file @
a5c32cfa
...
...
@@ -5,13 +5,14 @@ module GEODE.Options
,
Output
(
..
)
,
input
,
ioConfig
,
output
)
where
,
output
,
xmlOutput
)
where
import
Control.Applicative
((
<|>
))
import
Data.List.NonEmpty
(
NonEmpty
(
..
))
import
Options.Applicative
(
Parser
,
argument
,
flag'
,
help
,
long
,
metavar
,
short
,
str
,
strOption
,
value
)
import
Options.Applicative.
Types
(
oneM
,
manyM
,
fromM
)
import
Options.Applicative.
NonEmpty
(
some1
)
import
Text.Printf
(
printf
)
data
Input
=
StdIn
|
File
FilePath
...
...
@@ -21,24 +22,28 @@ input stdinSemantics =
argument
(
File
<$>
str
)
(
value
StdIn
<>
metavar
"INPUT_FILE"
<>
help
(
printf
"path of the file to process (%s)"
stdinSemantics
)
)
<>
metavar
"INPUT_FILE"
<>
help
(
printf
"path of the file to process (%s)"
stdinSemantics
)
)
data
Output
=
Metadata
|
TextRoot
FilePath
|
XMLRoot
FilePath
xmlOutput
::
Parser
FilePath
xmlOutput
=
strOption
(
long
"xml-root"
<>
metavar
"DIRECTORY"
<>
short
'x'
<>
help
"Root path where to output XML files"
)
output
::
Parser
Output
output
=
flag'
Metadata
(
long
"metadata"
<>
short
'm'
<>
help
"Print metadata for splitted files on stdout"
)
<>
short
'm'
<>
help
"Print metadata for splitted files on stdout"
)
<|>
(
TextRoot
<$>
strOption
(
long
"text-root"
<>
short
't'
<>
help
"Root path where to output text files"
))
<|>
(
XMLRoot
<$>
strOption
(
long
"xml-root"
<>
short
'x'
<>
help
"Root path where to output XML files"
))
<>
metavar
"DIRECTORY"
<>
short
't'
<>
help
"Root path where to output text files"
))
<|>
(
XMLRoot
<$>
xmlOutput
)
data
IOConfig
=
IOConfig
{
from
::
Input
...
...
@@ -47,8 +52,4 @@ data IOConfig = IOConfig
ioConfig
::
String
->
Parser
IOConfig
ioConfig
stdinSemantics
=
IOConfig
<$>
input
stdinSemantics
<*>
some
output
where
-- trick needed to avoid duplicated options in help message (occurring when
-- working directly at the Applicative level)
some
p
=
fromM
((
:|
)
<$>
oneM
p
<*>
manyM
p
)
<*>
some1
output
This diff is collapsed.
Click to expand it.