mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +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() {
|
||||
local list listname count num_pipes domain enabled status
|
||||
local list listname count num_pipes domain enabled status nicedate
|
||||
|
||||
listname="${listType}"
|
||||
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
|
||||
domain="$(cut -d'|' -f"-$((num_pipes-2))" <<< "${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
|
||||
if [[ "${enabled}" -eq 1 ]]; then
|
||||
status="enabled"
|
||||
|
@ -204,7 +206,10 @@ Displaylist() {
|
|||
status="disabled"
|
||||
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))
|
||||
done <<< "${data}"
|
||||
exit 0;
|
||||
|
|
Loading…
Reference in a new issue