maintainer-feedback requested: [Bug 284263] ports-mgmt/pkg: [1.21.3] --raw-format is broken when multiple packages are supplied

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 22 Jan 2025 15:51:45 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-pkg (Nobody)
<pkg@FreeBSD.org> for maintainer-feedback:
Bug 284263: ports-mgmt/pkg: [1.21.3] --raw-format is broken when multiple
packages are supplied
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284263



--- Description ---
pkg version: pkg-1.21.3, json_verify comes from devel/yajl

$ pkg info --raw --raw-format json pkg | json_verify
JSON is valid
$ pkg info --raw --raw-format json pkg bash | json_verify
parse error: trailing garbage
					{     "name": "pkg",	 "orig
		     (right here) ------^
JSON is invalid


This is because `pkg info .. $THING` returns a JSON object,
but `pkg info .. $THING1 $THING2` returns 2 JSON objects:

```
...
}{
    "name": "bash",
    "origin": "shells/bash",
...
```

One possible solution is to wrap multiple packages in an array, and add
a , separator.

Also, --raw-format *requires* --raw, perhaps set --raw flag if --raw-format
is already found on command line.