Enable list to have two modus operandi, either way it is limited to the password store

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/kanako/trunk@21 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
This commit is contained in:
yakumo.izuru 2023-10-25 01:20:10 +00:00
parent 1b9cf3c65a
commit f73d683a30

8
kanako
View File

@ -32,7 +32,11 @@ edit() {
rm "${1%%.enc}"
}
list() {
if [ -z "$1" ]; then
$(which tree) "${kanako_store_dir}/" | sed 's/\.enc//g'
else
$(which tree) "${1:-.}" | sed 's/\.enc//g'
fi
}
new() {
test -d $1 && usage && exit 1
@ -59,7 +63,7 @@ view() {
if [ -f "${1%%.enc}".enc ]; then
${kanako_encrypt_cmd} ${kanako_decrypt_args} "${1%%.enc}".enc
elif [ -d "${1:-.}" ]; then
$(which tree) "${1:-.}" | sed 's/\.enc//g'
list "${1:-.}"
else
usage
fi
@ -68,7 +72,7 @@ view() {
case $1 in
-c) copy $2 ;;
-e) edit $2 ;;
-l) list ;;
-l) list $2;;
-n) new $2 ;;
-R) trash_directory $2 ;;
-r) trash_file $2 ;;