|
|
@@ -40,6 +40,15 @@ update() { |
|
|
|
rm_recent "$1" |
|
|
|
} |
|
|
|
|
|
|
|
updatedirs() { |
|
|
|
cache_name="$1" |
|
|
|
if [ -z "$1" ]; then cache_name=home; fi |
|
|
|
path="$(printf $cache_info | grep "^$cache_name" - | cut -d: -f2)" |
|
|
|
if [ -z "$path" ]; then printf "invalid cache name: $1\n" 1>&2; exit; fi |
|
|
|
|
|
|
|
list "$1" | sed -n 's:\(.*\)/.*$:\1:p' | sort -u >$XDG_CACHE_HOME/mru/"$cache_name.dirs" |
|
|
|
} |
|
|
|
|
|
|
|
# This remove duplicates by deleting files in recent from the main file |
|
|
|
rm_recent() { |
|
|
|
file=$XDG_CACHE_HOME/mru/$1 |
|
|
@@ -66,6 +75,15 @@ list() { |
|
|
|
output "$1" | cut -f3 |
|
|
|
} |
|
|
|
|
|
|
|
listdirs() { |
|
|
|
cache_name="$1" |
|
|
|
if [ -z "$1" ]; then cache_name=home; fi |
|
|
|
path="$(printf $cache_info | grep "^$cache_name" - | cut -d: -f2)" |
|
|
|
if [ -z "$path" ]; then printf "invalid cache name: $1\n" 1>&2; exit; fi |
|
|
|
|
|
|
|
cat $XDG_CACHE_HOME/mru/"$cache_name.dirs" |
|
|
|
} |
|
|
|
|
|
|
|
insert() { |
|
|
|
if [ -z "$1" ]; then printf "No path given\n" 1>&2; exit; fi |
|
|
|
cache_name=$2 |
|
|
@@ -94,7 +112,9 @@ insert() { |
|
|
|
case "$1" in |
|
|
|
init) init "$2";; |
|
|
|
update) update $2;; |
|
|
|
updatedirs) updatedirs "$2";; |
|
|
|
output) output "$2";; |
|
|
|
list) list "$2";; |
|
|
|
listdirs) listdirs "$2";; |
|
|
|
insert) insert "$2" "$3";; |
|
|
|
esac |