Skip to content

Commit 0eb6dd6

Browse files
Rename the --which values
1 parent 0a14362 commit 0eb6dd6

File tree

2 files changed

+32
-24
lines changed

2 files changed

+32
-24
lines changed

NEWS.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
### New Features
44

55
* Add option `--which=<values>` for `rsc config`, which default to
6-
`--which="rsc,rstudio,user"`, where `rsc` displays the RStudio
6+
`--which="rsc,rstudio,sessions"`, where `rsc` displays the RStudio
77
Server Controller settings, `rstudio` the RStudio configuration,
8-
and `user` on the RStudio user storage.
8+
and `user` on the RStudio sessions storage.
99

1010
* Add option `--which=<values>` for `rsc reset`, which default to
1111
support for `rsc reset --which="rsc"`, which resets the RStudio
12-
Server Controller settings. If `user`, the user's RStudio state
13-
storage folder (e.g. `~/.local/share/rstudio`) to a dated tar file,
14-
and then remove that folder. This can be used as a last resort when
15-
the RStudio Server gets stuck at "R is taking longer to start than
16-
usual" after logging in.
12+
Server Controller settings. If `sessions`, the user's RStudio
13+
sessions folder (e.g. `~/.local/share/rstudio`) to a dated tar
14+
file, and then remove that folder. This can be used as a last
15+
resort when the RStudio Server gets stuck at "R is taking longer to
16+
start than usual" after logging in.
1717

1818
* Add environment variable `RSC_RSESSION_TIMEOUT_SUSPEND` to control
1919
whether a timed out R session should be suspended to disk. If `1`

bin/rsc

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
### --which=<parts> Controls which, comma-separated, parts 'rsc config' and
4747
### 'rsc reset' report on and reset, respectively, where
4848
### 'rsc' specifies the RSC configuration, 'rstudio' the
49-
### RStudio configuration, and 'user' on the RStudio user
50-
### settings
49+
### RStudio configuration, and 'sessions' on the RStudio
50+
### sessions storage
5151
### ---
5252
###
5353
### Example:
@@ -65,17 +65,17 @@
6565
### rsc stop
6666
###
6767
### rsc config
68-
### rsc config --which=rsc,rstudio,user (default)
68+
### rsc config --which=rsc,rstudio,sessions (default)
6969
### rsc config --full
7070
### rsc config --which=rstudio --full
7171
### rsc log
7272
###
7373
### rsc reset
74-
### rsc reset --which=rsc (default)
74+
### rsc reset --which=rsc (default)
7575
### rsc reset --force
76-
### rsc reset --which=user
76+
### rsc reset --which=session
7777
###
78-
### Version: 0.16.2-9007
78+
### Version: 0.16.2-9008
7979
### Copyright: Henrik Bengtsson (2022-2024) and Harry Putnam (2022)
8080
### License: ISC
8181

@@ -1521,7 +1521,7 @@ parse_opt_which() {
15211521
fi
15221522
for part in "${parts[@]}"; do
15231523
case "${part}" in
1524-
"rsc" | "rstudio" | "user")
1524+
"rsc" | "rstudio" | "sessions")
15251525
;;
15261526
*)
15271527
error "Unknown value of --which=<values> option: ${1}"
@@ -1552,9 +1552,9 @@ while [[ $# -gt 0 ]]; do
15521552
fi
15531553
elif [[ "$1" == "config" ]]; then
15541554
action="$1"
1555-
## 'rsc config' defaults to --which="rsc,rstudio,user"
1555+
## 'rsc config' defaults to --which="rsc,rstudio,sessions"
15561556
if [[ ${#which[@]} -eq 0 ]]; then
1557-
which=(rsc rstudio user)
1557+
which=(rsc rstudio sessions)
15581558
fi
15591559
elif [[ "$1" == "log" ]]; then
15601560
action="$1"
@@ -1709,7 +1709,10 @@ if [[ "${action}" == "config" ]]; then
17091709
for what in "${which[@]}"; do
17101710
if [[ ${what} == "rsc" ]]; then
17111711
files=()
1712-
1712+
1713+
echo "==========================================================="
1714+
echo "RStudio Server Controller"
1715+
echo "==========================================================="
17131716
echo "RStudio Server Controller Settings:"
17141717
echo "RSC_AUTH: ${RSC_AUTH:-<not set>}"
17151718
echo "RSC_ENV_PATTERN: ${RSC_ENV_PATTERN:-<not set>}"
@@ -1777,7 +1780,9 @@ if [[ "${action}" == "config" ]]; then
17771780
done
17781781
fi
17791782
elif [[ ${what} == "rstudio" ]]; then
1780-
echo "RStudio User Configuration:"
1783+
echo "==========================================================="
1784+
echo "RStudio User Configuration"
1785+
echo "==========================================================="
17811786
echo "XDG_CONFIG_HOME: ${XDG_CONFIG_HOME:-<not set>}"
17821787
echo "RSTUDIO_CONFIG_HOME: ${RSTUDIO_CONFIG_HOME:-<not set>}"
17831788
workdir=$(rstudio_config_home)
@@ -1786,9 +1791,12 @@ if [[ "${action}" == "config" ]]; then
17861791
echo "RStudio user preferences: ${file} [$(file_info "${file}")]"
17871792
if $full && [[ -f "${file}" ]]; then
17881793
cat "${file}"
1794+
echo
17891795
fi
1790-
elif [[ ${what} == "user" ]]; then
1791-
echo "RStudio User State Storage:"
1796+
elif [[ ${what} == "sessions" ]]; then
1797+
echo "==========================================================="
1798+
echo "RStudio User Sessions"
1799+
echo "==========================================================="
17921800
echo "XDG_DATA_HOME: ${XDG_DATA_HOME:-<not set>}"
17931801
echo "RSTUDIO_DATA_HOME: ${RSTUDIO_DATA_HOME:-<not set>}"
17941802
workdir=$(rstudio_data_home)
@@ -1915,20 +1923,20 @@ elif [[ "${action}" == "reset" ]]; then
19151923
fi
19161924
elif [[ ${what} == "rstudio" ]]; then
19171925
error "rsc reset --which=${what} is not supported"
1918-
elif [[ ${what} == "user" ]]; then
1926+
elif [[ ${what} == "sessions" ]]; then
19191927
## Reset the RStudio User State Storage?
19201928
workdir=$(rstudio_data_home)
19211929
if [[ -d "${workdir}" ]]; then
19221930
now=$(date +"%Y%m%dT%H%M%S")
19231931
dest="rstudio-config_${now}.tar"
19241932
tar -c -f "${dest}" "${workdir}"
19251933
if [[ -f "${dest}" ]]; then
1926-
message "Backed up your personal RStudio User State Storage: ${PWD}/${dest} [$(file_info "${dest}")]"
1934+
message "Backed up your personal RStudio sessions storage: ${PWD}/${dest} [$(file_info "${dest}")]"
19271935
rm -r -f "${workdir}"
1928-
message "Removed your personal RStudio User State Storage: ${workdir}"
1936+
message "Removed your personal RStudio sessions storage: ${workdir}"
19291937
fi
19301938
else
1931-
message "Nothing to do - RStudio User State Storage folder does not exist: ${workdir}"
1939+
message "Nothing to do - RStudio sessions storage folder does not exist: ${workdir}"
19321940
fi
19331941
fi
19341942
done

0 commit comments

Comments
 (0)