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 39 40 41 42
|
#!/bin/bash
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Copyright (C) 2025 Karel Zak <kzak@redhat.com>
#
TS_TOPDIR="${0%/*}/../.."
TS_DESC="colors"
. "$TS_TOPDIR"/functions.sh
ts_init "$*"
ts_check_test_command "$TS_HELPER_COLORS"
ts_cd "$TS_OUTDIR"
SRC="${top_srcdir}/lib/color-names.c"
COLOR_NAMES=$(awk '
/basic_schemes\[\]/ { in_array=1; next }
in_array && /};/ { exit }
in_array && /\{[[:space:]]*"/ {
sub(/.*\{[[:space:]]*"/, "")
if (match($0, /[^"]*/)) {
name = substr($0, RSTART, RLENGTH)
print name
}
}
' "$SRC")
for color in $COLOR_NAMES; do
printf "%15s: " "$color" >> $TS_OUTPUT
$TS_HELPER_COLORS --mode always --color "$color" >> $TS_OUTPUT 2>> $TS_ERRLOG
done
ts_finalize
|