mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-28 09:45:07 +00:00
Merge pull request #2663 from eikek/fix/2629-collect-output-default
Honor default value `true` for `collectOutput`
This commit is contained in:
commit
b7f53c78d8
modules/addonlib/src
@ -110,7 +110,7 @@ private[addons] object RunnerUtil {
|
|||||||
): F[AddonResult] =
|
): F[AddonResult] =
|
||||||
for {
|
for {
|
||||||
stdout <-
|
stdout <-
|
||||||
if (ctx.meta.options.exists(_.collectOutput)) CollectOut.buffer[F]
|
if (ctx.meta.parseResult) CollectOut.buffer[F]
|
||||||
else CollectOut.none[F].pure[F]
|
else CollectOut.none[F].pure[F]
|
||||||
cmdResult <- SysExec(cmd, logger, ctx.baseDir.some)
|
cmdResult <- SysExec(cmd, logger, ctx.baseDir.some)
|
||||||
.flatMap(
|
.flatMap(
|
||||||
@ -135,7 +135,7 @@ private[addons] object RunnerUtil {
|
|||||||
out <- stdout.get
|
out <- stdout.get
|
||||||
_ <- logger.debug(s"Addon stdout: $out")
|
_ <- logger.debug(s"Addon stdout: $out")
|
||||||
result = Option
|
result = Option
|
||||||
.when(ctx.meta.options.exists(_.collectOutput) && out.nonEmpty)(
|
.when(ctx.meta.parseResult && out.nonEmpty)(
|
||||||
JsonParser
|
JsonParser
|
||||||
.decode[AddonOutput](out)
|
.decode[AddonOutput](out)
|
||||||
.fold(AddonResult.decodingError, AddonResult.success)
|
.fold(AddonResult.decodingError, AddonResult.success)
|
||||||
|
@ -35,4 +35,13 @@ class AddonMetaTest extends CatsEffectSuite with TestLoggingConfig with Fixtures
|
|||||||
_ = assertEquals(meta, dummyAddonMeta)
|
_ = assertEquals(meta, dummyAddonMeta)
|
||||||
} yield ()
|
} yield ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("parse yaml with defaults") {
|
||||||
|
val yamlStr = """meta:
|
||||||
|
| name: "test"
|
||||||
|
| version: "0.1.0"
|
||||||
|
|""".stripMargin
|
||||||
|
val meta = AddonMeta.fromYamlString(yamlStr).fold(throw _, identity)
|
||||||
|
assert(meta.parseResult)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user