Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
69237e6e
Commit
69237e6e
authored
Mar 02, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving modes to first position in args, closes #179
parent
3da50156
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
Flags.hs
src/IHaskell/Flags.hs
+17
-2
No files found.
src/IHaskell/Flags.hs
View file @
69237e6e
...
...
@@ -10,6 +10,7 @@ module IHaskell.Flags (
import
ClassyPrelude
import
System.Console.CmdArgs.Explicit
import
System.Console.CmdArgs.Text
import
Data.List
(
findIndex
)
import
IHaskell.Types
...
...
@@ -39,7 +40,21 @@ data IHaskellMode
-- | Given a list of command-line arguments, return the IHaskell mode and
-- arguments to process.
parseFlags
::
[
String
]
->
Either
String
Args
parseFlags
=
process
ihaskellArgs
parseFlags
flags
=
let
modeIndex
=
findIndex
(`
elem
`
modeFlags
)
flags
in
case
modeIndex
of
Nothing
->
Left
$
"No mode provided. Modes available are: "
++
show
modeFlags
Just
0
->
process
ihaskellArgs
flags
-- If mode not first, move it to be first.
Just
idx
->
let
(
start
,
first
:
end
)
=
splitAt
idx
flags
in
process
ihaskellArgs
$
first
:
start
++
end
where
modeFlags
=
concatMap
modeNames
allModes
allModes
::
[
Mode
Args
]
allModes
=
[
console
,
notebook
,
view
,
kernel
]
-- | Get help text for a given IHaskell ode.
help
::
IHaskellMode
->
String
...
...
@@ -116,7 +131,7 @@ ihaskellArgs =
helpStr
=
showText
(
Wrap
100
)
$
helpText
[]
HelpFormatAll
ihaskellArgs
onlyHelp
=
[
flagHelpSimple
(
add
Help
)]
noMode
=
mode
"IHaskell"
(
Args
(
ShowHelp
helpStr
)
[]
)
descr
noArgs
onlyHelp
in
noMode
{
modeGroupModes
=
toGroup
[
console
,
notebook
,
view
,
kernel
]
}
noMode
{
modeGroupModes
=
toGroup
allModes
}
where
add
flag
(
Args
mode
flags
)
=
Args
mode
$
flag
:
flags
...
...
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