-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
mpbb-show-config-logs
38 lines (32 loc) · 1.02 KB
/
mpbb-show-config-logs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 <<EOF
usage: $prog [<global opts>] port-show-config-logs <port>
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
}