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
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
Grégoire Locqueville
haskell-gargantext
Commits
5760e558
Commit
5760e558
authored
Jul 01, 2024
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port gargantext-init to CLI
parent
1310b3a3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
30 deletions
+29
-30
Init.hs
bin/gargantext-cli/CLI/Init.hs
+18
-13
Types.hs
bin/gargantext-cli/CLI/Types.hs
+5
-0
Main.hs
bin/gargantext-cli/Main.hs
+5
-1
gargantext.cabal
gargantext.cabal
+1
-16
No files found.
bin/gargantext-
init/Main
.hs
→
bin/gargantext-
cli/CLI/Init
.hs
View file @
5760e558
{-|
Module :
Main
.hs
Description : Gargantext I
mport Corpus
Module :
Init
.hs
Description : Gargantext I
nit Script
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
I
mport a corpus binary
.
I
nitialise the Gargantext dataset
.
-}
{-# LANGUAGE Strict #-}
module
Main
where
module
CLI.Init
where
import
Data.List.NonEmpty
qualified
as
NE
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdDev
)
...
...
@@ -32,16 +32,12 @@ import Gargantext.Prelude
import
Gargantext.Prelude.Config
(
GargConfig
(
..
),
readConfig
)
import
Gargantext.API.Admin.Types
import
Gargantext.Database.Prelude
(
DBCmd
'
)
import
CLI.Types
import
Options.Applicative
main
::
IO
()
main
=
do
params
@
[
iniPath
]
<-
getArgs
_
<-
if
length
params
/=
1
then
panicTrace
"USAGE: ./gargantext-init gargantext.ini"
else
pure
()
initCLI
::
InitArgs
->
IO
()
initCLI
(
InitArgs
iniPath
)
=
do
putStrLn
(
"Enter master user (gargantua) _password_ :"
::
Text
)
password
<-
getLine
...
...
@@ -77,4 +73,13 @@ main = do
x
<-
runCmdDev
env
initMaster
_
<-
runCmdDev
env
mkRoots
putStrLn
(
show
x
::
Text
)
pure
()
initCmd
::
HasCallStack
=>
Mod
CommandFields
CLI
initCmd
=
command
"init"
(
info
(
helper
<*>
fmap
CLISub
init_p
)
(
progDesc
"Initialise this Gargantext instance."
))
init_p
::
Parser
CLICmd
init_p
=
fmap
CCMD_init
$
InitArgs
<$>
(
strOption
(
long
"ini-path"
<>
metavar
"FILEPATH"
<>
help
"Location of the .ini path"
)
)
bin/gargantext-cli/CLI/Types.hs
View file @
5760e558
...
...
@@ -43,12 +43,17 @@ data ImportArgs = ImportArgs
,
imp_corpus_path
::
!
FilePath
}
deriving
(
Show
,
Eq
)
data
InitArgs
=
InitArgs
{
init_ini
::
!
FilePath
}
deriving
(
Show
,
Eq
)
data
CLICmd
=
CCMD_clean_csv_corpus
|
CCMD_filter_terms_and_cooc
!
CorpusFile
!
TermListFile
!
OutputFile
|
CCMD_obfuscate_db
!
ObfuscateDBArgs
|
CCMD_admin
!
AdminArgs
|
CCMD_import
!
ImportArgs
|
CCMD_init
!
InitArgs
deriving
(
Show
,
Eq
)
data
CLI
=
...
...
bin/gargantext-cli/Main.hs
View file @
5760e558
...
...
@@ -25,6 +25,7 @@ import CLI.Types
import
Options.Applicative
import
CLI.Admin
(
adminCLI
,
adminCmd
)
import
CLI.Import
(
importCLI
,
importCmd
)
import
CLI.Init
(
initCLI
,
initCmd
)
runCLI
::
CLI
->
IO
()
runCLI
=
\
case
...
...
@@ -38,6 +39,8 @@ runCLI = \case
->
adminCLI
args
CLISub
(
CCMD_import
args
)
->
importCLI
args
CLISub
(
CCMD_init
args
)
->
initCLI
args
main
::
IO
()
main
=
runCLI
=<<
execParser
opts
...
...
@@ -52,5 +55,6 @@ allOptions = subparser (
filterTermsAndCoocCmd
<>
obfuscateDBCmd
<>
adminCmd
<>
importCmd
importCmd
<>
initCmd
)
gargantext.cabal
View file @
5760e558
...
...
@@ -702,6 +702,7 @@ executable gargantext-cli
CLI.CleanCsvCorpus
CLI.FilterTermsAndCooc
CLI.Import
CLI.Init
CLI.ObfuscateDB
CLI.Types
CLI.Utils
...
...
@@ -728,22 +729,6 @@ executable gargantext-cli
, unordered-containers ^>= 0.2.16.0
, vector ^>= 0.12.3.0
executable gargantext-init
import:
defaults
, optimized
main-is: Main.hs
other-modules:
Paths_gargantext
hs-source-dirs:
bin/gargantext-init
build-depends:
cron ^>= 0.7.0
, extra ^>= 1.7.9
, gargantext
, gargantext-prelude
, text ^>= 1.2.4.1
executable gargantext-invitations
import:
defaults
...
...
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