commit 0f0f1e9bca3ad7acb10c0e14c1d7606301f4d987
parent d01734374a4e8ed261295a23b909f2d942fd50d8
Author: Antoine A <>
Date: Wed, 5 Mar 2025 17:54:45 +0100
nexus: manual export/import to and from stdin/stdout
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/Manual.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/Manual.kt
@@ -43,7 +43,7 @@ class ExportCmt: CliktCommand("export") {
override fun help(context: Context) = "Export pending batches as pain001 messages"
private val common by CommonOption()
- private val out by argument().file()
+ private val out by argument().outputStream()
override fun run() = cliCmd(logger, common.log) {
nexusConfig(common.config).withDb { db, cfg ->
@@ -52,7 +52,7 @@ class ExportCmt: CliktCommand("export") {
val batches = db.initiated.submittable()
var nbTx: Int = 0
- ZipOutputStream(BufferedOutputStream(FileOutputStream(out))).use { zip ->
+ ZipOutputStream(BufferedOutputStream(out)).use { zip ->
val ebicsCfg = cfg.ebics
for (batch in batches) {
nbTx = batch.payments.size
@@ -81,13 +81,13 @@ class ImportCmt: CliktCommand("import") {
override fun help(context: Context) = "Import EBICS camt files"
private val common by CommonOption()
- private val sources by argument().file().multiple(required = true)
+ private val sources by argument().inputStream().multiple(required = true)
override fun run() = cliCmd(logger, common.log) {
nexusConfig(common.config).withDb { db, cfg ->
for (source in sources) {
var nbTx: Int = 0
- source.inputStream().use { xml ->
+ source.use { xml ->
nbTx += registerTxs(db, cfg, xml)
}
println("Imported $nbTx transactions from $source")