mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-25 08:45:04 +00:00
parent
870bfd9cf0
commit
fd2b897f2f
@ -110,7 +110,7 @@ private[addons] object RunnerUtil {
|
||||
): F[AddonResult] =
|
||||
for {
|
||||
stdout <-
|
||||
if (ctx.meta.options.exists(_.collectOutput)) CollectOut.buffer[F]
|
||||
if (ctx.meta.parseResult) CollectOut.buffer[F]
|
||||
else CollectOut.none[F].pure[F]
|
||||
cmdResult <- SysExec(cmd, logger, ctx.baseDir.some)
|
||||
.flatMap(
|
||||
@ -135,7 +135,7 @@ private[addons] object RunnerUtil {
|
||||
out <- stdout.get
|
||||
_ <- logger.debug(s"Addon stdout: $out")
|
||||
result = Option
|
||||
.when(ctx.meta.options.exists(_.collectOutput) && out.nonEmpty)(
|
||||
.when(ctx.meta.parseResult && out.nonEmpty)(
|
||||
JsonParser
|
||||
.decode[AddonOutput](out)
|
||||
.fold(AddonResult.decodingError, AddonResult.success)
|
||||
|
@ -35,4 +35,13 @@ class AddonMetaTest extends CatsEffectSuite with TestLoggingConfig with Fixtures
|
||||
_ = assertEquals(meta, dummyAddonMeta)
|
||||
} 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