From ffe6efd0e5370ba5652440bcde8b10b81216f7c1 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sun, 15 Dec 2019 21:16:57 -0700 Subject: [PATCH 1/2] add json output for jail list --- usr/local/share/bastille/list.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr/local/share/bastille/list.sh b/usr/local/share/bastille/list.sh index 33f493f3..630bc7eb 100644 --- a/usr/local/share/bastille/list.sh +++ b/usr/local/share/bastille/list.sh @@ -37,7 +37,11 @@ usage() { } if [ $# -eq 0 ]; then - jls -N + jls -N +fi + +if [ "$1" == "-j" ]; then + jls -N --libxo json fi if [ $# -gt 0 ]; then From 71873e9389edd745b667e39e49c1504ced4968bf Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sun, 15 Dec 2019 21:20:34 -0700 Subject: [PATCH 2/2] readme update --- README.md | 2 +- usr/local/share/bastille/list.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b63ef6d8..a8bba1f4 100644 --- a/README.md +++ b/README.md @@ -364,7 +364,7 @@ ishmael ~ # bastille list You can also list non-running containers with `bastille list containers`. In the same manner you can list archived `logs`, downloaded `templates`, and -`releases`. +`releases`. Providing the `-j` flag to list alone will result in JSON output. bastille service diff --git a/usr/local/share/bastille/list.sh b/usr/local/share/bastille/list.sh index 630bc7eb..97ec4616 100644 --- a/usr/local/share/bastille/list.sh +++ b/usr/local/share/bastille/list.sh @@ -32,7 +32,7 @@ . /usr/local/etc/bastille/bastille.conf usage() { - echo -e "${COLOR_RED}Usage: bastille list [release|template|(jail|container)|log].${COLOR_RESET}" + echo -e "${COLOR_RED}Usage: bastille list [-j] [release|template|(jail|container)|log].${COLOR_RESET}" exit 1 } @@ -42,6 +42,7 @@ fi if [ "$1" == "-j" ]; then jls -N --libxo json + exit 0 fi if [ $# -gt 0 ]; then