From 596569bc0b5e70b43840b84b53c9e670bc273d6a Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Mon, 3 Aug 2020 08:05:37 -0500 Subject: [PATCH] Add mpbb-show-config-logs --- mpbb-show-config-logs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 mpbb-show-config-logs diff --git a/mpbb-show-config-logs b/mpbb-show-config-logs new file mode 100644 index 0000000..f41f385 --- /dev/null +++ b/mpbb-show-config-logs @@ -0,0 +1,38 @@ +#!/bin/bash +# -*- coding: utf-8; mode: sh; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=sh:et:sw=4:ts=4:sts=4 + +# Note: +# This script is sourced by the mpbb wrapper script. +# Do not execute this directly! + +show-config-logs-usage() { + # "prog" is defined in mpbb-help. + # shellcheck disable=SC2154 + cat <] port-show-config-logs + +Show the config.log files of the given port. + +Run \`$prog help' for global options and a list of other subcommands. +EOF +} + +show-config-logs() { + local port=${1-} + if [[ -z $port ]]; then + err "Must specify a port" + return 1 + fi + + # $option_prefix is set in mpbb + # shellcheck disable=SC2154 + workpath=$("${option_prefix}/bin/port" work "$port") || return + if [[ -n $workpath ]]; then + cd "$workpath" + find -s . -name config.log -print0 \ + | xargs -0 -n 1 -I @ sh -c \ + 'printf -- "%s:\n" "@" 1>&2; \ + cat "@"; \ + printf "\n"' + fi +}