Commit 940cb0e2 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[BIN] Command line options with help: ~/.local/bin/gargantext --help

parent 761dcb39
......@@ -9,10 +9,14 @@ Portability : POSIX
-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeOperators #-}
module Main where
......@@ -23,27 +27,27 @@ import Data.Text (unpack)
import Gargantext.Prelude
import Gargantext.API (startGargantext, startGargantextMock)
------------------------------------------------------
--------------------------------------------------------
data Mode = Dev | Mock | Prod
deriving (Show, Read, Generic)
deriving (Show, Read, Generic)
instance ParseRecord Mode
instance ParseField Mode
instance ParseFields Mode
data MyOptions = MyOptions { run :: Mode
, port :: Maybe Int
, iniFile :: Maybe Text
}
deriving (Generic, Show)
instance ParseRecord MyOptions
data MyOptions w = MyOptions { run :: w ::: Mode <?> "Possible modes: Dev | Mock | Prod"
, port :: w ::: Maybe Int <?> "By default: 8008"
, iniFile :: w ::: Maybe Text <?> "Example file: gargantext.ini"
}
deriving (Generic)
instance ParseRecord (MyOptions Wrapped)
deriving instance Show (MyOptions Unwrapped)
main :: IO ()
main = do
MyOptions myMode myPort myIniFile <- getRecord
MyOptions myMode myPort myIniFile <- unwrapRecord
"Gargantext: collaborative platform for text-mining"
let myPort' = case myPort of
......@@ -58,7 +62,7 @@ main = do
Nothing -> panic "Need gargantext.ini file"
Just i -> i
Mock -> startGargantextMock myPort'
Dev -> startGargantextMock myPort'
_ -> startGargantextMock myPort'
putStrLn $ "Starting Gargantext with mode: " <> show myMode
start
......@@ -126,11 +126,11 @@ executable:
source-dirs: app
ghc-options: -threaded -rtsopts -with-rtsopts=-N -O2
dependencies:
- base
- gargantext
- ini
- base
- unordered-containers
- optparse-generic
- unordered-containers
tests:
garg-test:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment