Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
153
Issues
153
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
haskell-gargantext
Commits
5097fc6d
Commit
5097fc6d
authored
Mar 05, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[COMMAND LINe] improve optiosn to run at startup.
parent
193325e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
Main.hs
app/Main.hs
+11
-10
No files found.
app/Main.hs
View file @
5097fc6d
...
...
@@ -16,6 +16,8 @@ Portability : POSIX
module
Main
where
import
Prelude
(
putStrLn
)
import
Options.Generic
import
Data.Text
(
unpack
)
...
...
@@ -27,37 +29,36 @@ import Gargantext.API (startGargantext, startGargantextMock)
data
Mode
=
Dev
|
Mock
|
Prod
deriving
(
Show
,
Read
,
Generic
)
instance
ParseRecord
Mode
instance
ParseField
Mode
instance
ParseField
Mode
instance
ParseFields
Mode
data
MyOptions
=
MyOptions
{
port
::
Maybe
Int
data
MyOptions
=
MyOptions
{
run
::
Mode
,
port
::
Maybe
Int
,
iniFile
::
Maybe
Text
,
mode
::
Maybe
Mode
}
}
deriving
(
Generic
,
Show
)
instance
ParseRecord
MyOptions
main
::
IO
()
main
=
do
MyOptions
my
Port
myIniFile
myMode
<-
getRecord
MyOptions
my
Mode
myPort
myIniFile
<-
getRecord
"Gargantext: collaborative platform for text-mining"
let
myPort'
=
case
myPort
of
Just
p
->
p
Nothing
->
8008
let
start
=
case
myMode
of
--Nothing -> startGargantext myPort' (unpack myIniFile')
Just
Prod
->
startGargantext
myPort'
(
unpack
myIniFile'
)
Prod
->
startGargantext
myPort'
(
unpack
myIniFile'
)
where
myIniFile'
=
case
myIniFile
of
Nothing
->
panic
"Need gargantext.ini file"
Just
i
->
i
Just
Mock
->
startGargantextMock
myPort'
_
->
startGargantextMock
myPort'
Mock
->
startGargantextMock
myPort'
Dev
->
startGargantextMock
myPort'
putStrLn
$
"Starting Gargantext with mode: "
<>
show
myMode
start
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