mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Also print datetime a domain was added when listing the domains on the CLI
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
08ee9526ad
commit
6b1d2523e8
1 changed files with 7 additions and 2 deletions
|
@ -175,7 +175,7 @@ RemoveDomain() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Displaylist() {
|
Displaylist() {
|
||||||
local list listname count num_pipes domain enabled status
|
local list listname count num_pipes domain enabled status nicedate
|
||||||
|
|
||||||
listname="${listType}"
|
listname="${listType}"
|
||||||
data="$(sqlite3 "${gravityDBfile}" "SELECT * FROM ${listType};" 2> /dev/null)"
|
data="$(sqlite3 "${gravityDBfile}" "SELECT * FROM ${listType};" 2> /dev/null)"
|
||||||
|
@ -196,7 +196,9 @@ Displaylist() {
|
||||||
# Extract domain and enabled status based on the obtained number of pipe characters
|
# Extract domain and enabled status based on the obtained number of pipe characters
|
||||||
domain="$(cut -d'|' -f"-$((num_pipes-2))" <<< "${line}")"
|
domain="$(cut -d'|' -f"-$((num_pipes-2))" <<< "${line}")"
|
||||||
enabled="$(cut -d'|' -f"$((num_pipes-1))" <<< "${line}")"
|
enabled="$(cut -d'|' -f"$((num_pipes-1))" <<< "${line}")"
|
||||||
|
dateadded="$(cut -d'|' -f"$((num_pipes))" <<< "${line}")"
|
||||||
|
|
||||||
|
echo "${dateadded}"
|
||||||
# Translate boolean status into human readable string
|
# Translate boolean status into human readable string
|
||||||
if [[ "${enabled}" -eq 1 ]]; then
|
if [[ "${enabled}" -eq 1 ]]; then
|
||||||
status="enabled"
|
status="enabled"
|
||||||
|
@ -204,7 +206,10 @@ Displaylist() {
|
||||||
status="disabled"
|
status="disabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " ${count}: ${domain} (${status})"
|
# Get nice representation of numerical date stored in database
|
||||||
|
nicedate=$(date --rfc-2822 -d "@${dateadded}")
|
||||||
|
|
||||||
|
echo " ${count}: ${domain} (${status}, added ${nicedate})"
|
||||||
count=$((count+1))
|
count=$((count+1))
|
||||||
done <<< "${data}"
|
done <<< "${data}"
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
Loading…
Reference in a new issue