29 lines
536 B
Bash
Executable File
29 lines
536 B
Bash
Executable File
#!/usr/bin/env rc
|
|
|
|
# Dsilo - Switch denote directory (silo)
|
|
# Usage: Dsilo <directory-path>
|
|
# Dsilo (no args - show current silo)
|
|
|
|
mnt=$DENOTE_9MOUNT
|
|
if(~ $#mnt 0) mnt=$HOME/mnt/denote
|
|
|
|
if(~ $#* 1) {
|
|
newdir=$1
|
|
|
|
if(! test -d $newdir) {
|
|
echo 'error: directory does not exist:' $newdir >[1=2]
|
|
exit 1
|
|
}
|
|
|
|
absdir=`{cd $newdir && pwd}
|
|
|
|
echo 'cd '$absdir > $mnt/ctl && {
|
|
echo 'Switched to silo:' $absdir '. You may have to refresh the Denote window.'
|
|
exit 0
|
|
}
|
|
}
|
|
if not {
|
|
echo 'Denote Directory:' `{cat $mnt/dir}
|
|
exit 0
|
|
}
|