Skip to content

Commit ffd029d

Browse files
Now rsc config reports also on total directory sizes
1 parent 3fa86ff commit ffd029d

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
whether a timed out R session should be suspended to disk. If `1`
2020
(default), it will be suspended to disk, otherwise not.
2121

22+
* Now `rsc config` reports also on total directory sizes.
23+
2224
### Bug Fixes
2325

2426
* `rsc reset` did not remove the internal `rserver.pid` and

bin/incl/files.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,18 @@ function file_info {
5757
echo "<not available>"
5858
fi
5959
}
60+
61+
function dir_info {
62+
local dir=${1:?}
63+
local -i size
64+
local timestamp
65+
66+
if [[ -d "${dir}" ]]; then
67+
size=$(du --summarize --bytes "${dir}" | cut -f 1)
68+
timestamp=$(stat --format="%Y" "${dir}")
69+
timestamp=$(date -d "@${timestamp}" "+%F %T")
70+
echo "${size} bytes; ${timestamp}"
71+
else
72+
echo "<not available>"
73+
fi
74+
}

bin/rsc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
### rsc reset --force
7676
### rsc reset --which=user
7777
###
78-
### Version: 0.16.2-9005
78+
### Version: 0.16.2-9006
7979
### Copyright: Henrik Bengtsson (2022-2024) and Harry Putnam (2022)
8080
### License: ISC
8181

@@ -1731,7 +1731,7 @@ if [[ "${action}" == "config" ]]; then
17311731
echo "XDG_CONFIG_HOME: ${XDG_CONFIG_HOME:-<not set>}"
17321732

17331733
workdir=$(config_dir)
1734-
echo "config-dir: ${workdir}"
1734+
echo "config-dir: ${workdir} [$(dir_info "${workdir}")]"
17351735

17361736
file=${workdir}/pid.lock
17371737
echo "lockfile: ${file} [$(file_info "${file}")]"
@@ -1781,7 +1781,7 @@ if [[ "${action}" == "config" ]]; then
17811781
echo "XDG_CONFIG_HOME: ${XDG_CONFIG_HOME:-<not set>}"
17821782
echo "RSTUDIO_CONFIG_HOME: ${RSTUDIO_CONFIG_HOME:-<not set>}"
17831783
workdir=$(rstudio_config_home)
1784-
echo "RStudio config home: ${workdir}"
1784+
echo "RStudio config home: ${workdir} [$(dir_info "${workdir}")]"
17851785
file=${workdir}/rstudio-prefs.json
17861786
echo "RStudio user preferences: ${file} [$(file_info "${file}")]"
17871787
if $full && [[ -f "${file}" ]]; then
@@ -1792,7 +1792,7 @@ if [[ "${action}" == "config" ]]; then
17921792
echo "XDG_DATA_HOME: ${XDG_DATA_HOME:-<not set>}"
17931793
echo "RSTUDIO_DATA_HOME: ${RSTUDIO_DATA_HOME:-<not set>}"
17941794
workdir=$(rstudio_data_home)
1795-
echo "RStudio data home: ${workdir}"
1795+
echo "RStudio data home: ${workdir} [$(dir_info "${workdir}")]"
17961796
if $full && [[ -d "${workdir}" ]]; then
17971797
du --human-readable --si --summarize "${workdir}"/*
17981798
if [[ -d "${workdir}"/sessions/active/ ]]; then

0 commit comments

Comments
 (0)