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
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
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
f179e5aa
Verified
Commit
f179e5aa
authored
Oct 04, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[cli] ini: --dry-run option to output toml to stdout
parent
59c23118
Pipeline
#6755
failed with stages
in 33 minutes and 1 second
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
Ini.hs
bin/gargantext-cli/CLI/Ini.hs
+8
-4
Types.hs
bin/gargantext-cli/CLI/Types.hs
+1
-0
No files found.
bin/gargantext-cli/CLI/Ini.hs
View file @
f179e5aa
...
...
@@ -36,7 +36,7 @@ import Toml qualified
iniCLI
::
IniArgs
->
IO
()
iniCLI
iniArgs
=
do
iniCLI
iniArgs
@
(
IniArgs
{
dry_run
})
=
do
let
iniPath
=
fromMaybe
"gargantext.ini"
$
ini_path
iniArgs
let
tomlPath
=
fromMaybe
"gargantext-settings.toml"
$
toml_path
iniArgs
putStrLn
$
"Reading configuration from file "
<>
iniPath
<>
"..."
...
...
@@ -45,8 +45,11 @@ iniCLI iniArgs = do
iniNLP
<-
IniNLP
.
readConfig
iniPath
connInfo
<-
Ini
.
readDBConfig
iniPath
let
c
=
convertConfigs
ini
iniMail
iniNLP
connInfo
T
.
writeFile
tomlPath
(
show
(
Toml
.
encode
c
)
::
Text
)
putStrLn
$
"Converted configuration into TOML and wrote it to file "
<>
tomlPath
if
dry_run
then
putStrLn
(
show
(
Toml
.
encode
c
)
::
Text
)
else
do
T
.
writeFile
tomlPath
(
show
(
Toml
.
encode
c
)
::
Text
)
putStrLn
$
"Converted configuration into TOML and wrote it to file "
<>
tomlPath
iniCmd
::
HasCallStack
=>
Mod
CommandFields
CLI
iniCmd
=
command
"ini"
(
info
(
helper
<*>
fmap
CLISub
iniParser
)
...
...
@@ -55,7 +58,8 @@ iniCmd = command "ini" (info (helper <*> fmap CLISub iniParser)
iniParser
::
Parser
CLICmd
iniParser
=
fmap
CCMD_ini
$
IniArgs
<$>
(
optional
.
strOption
$
long
"ini-path"
<>
help
"Path to the input ini file"
)
<*>
(
optional
.
strOption
$
long
"toml-path"
<>
help
"Path to the output .toml file"
)
(
optional
.
strOption
$
long
"toml-path"
<>
help
"Path to the output .toml file"
)
<*>
(
flag
False
True
(
long
"dry-run"
<>
help
"If set, will only output generated .toml file to stdout"
))
convertConfigs
::
Ini
.
GargConfig
->
IniMail
.
MailConfig
->
IniNLP
.
NLPConfig
->
PGS
.
ConnectInfo
->
Config
.
GargConfig
convertConfigs
ini
@
(
Ini
.
GargConfig
{
..
})
iniMail
nlpConfig
connInfo
=
...
...
bin/gargantext-cli/CLI/Types.hs
View file @
f179e5aa
...
...
@@ -48,6 +48,7 @@ data ImportArgs = ImportArgs
data
IniArgs
=
IniArgs
{
ini_path
::
!
(
Maybe
FilePath
)
,
toml_path
::
!
(
Maybe
FilePath
)
,
dry_run
::
!
Bool
}
deriving
(
Show
,
Eq
)
data
InitArgs
=
InitArgs
...
...
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