Skip to content

Commit 389f465

Browse files
rsc config --full reports on more files + gives age of files and folders
1 parent 0eb6dd6 commit 389f465

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

bin/incl/files.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,21 @@ function file_info {
4747
local file=${1:?}
4848
local -i size
4949
local timestamp
50+
local now
51+
local age
5052

5153
if [[ -f "${file}" ]]; then
5254
size=$(stat --format="%s" "${file}")
5355
timestamp=$(stat --format="%Y" "${file}")
56+
now=$(date "+%s")
57+
age=$(( (now - timestamp) / 3600 ))
58+
if [[ ${age} -lt 48 ]]; then
59+
age="${age} hours ago"
60+
else
61+
age="$((age / 24)) days ago"
62+
fi
5463
timestamp=$(date -d "@${timestamp}" "+%F %T")
55-
echo "${size} bytes; ${timestamp}"
64+
echo "${size} bytes; ${timestamp} (${age})"
5665
else
5766
echo "<not available>"
5867
fi
@@ -62,12 +71,21 @@ function dir_info {
6271
local dir=${1:?}
6372
local -i size
6473
local timestamp
74+
local now
75+
local age
6576

6677
if [[ -d "${dir}" ]]; then
6778
size=$(du --summarize --bytes "${dir}" | cut -f 1)
6879
timestamp=$(stat --format="%Y" "${dir}")
80+
now=$(date "+%s")
81+
age=$(( (now - timestamp) / 3600 ))
82+
if [[ ${age} -lt 48 ]]; then
83+
age="${age} hours ago"
84+
else
85+
age="$((age / 24)) days ago"
86+
fi
6987
timestamp=$(date -d "@${timestamp}" "+%F %T")
70-
echo "${size} bytes; ${timestamp}"
88+
echo "${size} bytes; ${timestamp} (${age})"
7189
else
7290
echo "<not available>"
7391
fi

bin/rsc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,9 @@ if [[ "${action}" == "config" ]]; then
17871787
echo "RSTUDIO_CONFIG_HOME: ${RSTUDIO_CONFIG_HOME:-<not set>}"
17881788
workdir=$(rstudio_config_home)
17891789
echo "RStudio config home: ${workdir} [$(dir_info "${workdir}")]"
1790+
if $full && [[ -d "${workdir}" ]]; then
1791+
du --human-readable --si --summarize "${workdir}"/*
1792+
fi
17901793
file=${workdir}/rstudio-prefs.json
17911794
echo "RStudio user preferences: ${file} [$(file_info "${file}")]"
17921795
if $full && [[ -f "${file}" ]]; then

0 commit comments

Comments
 (0)