Fix bugs, update docs

Signed-off-by: Aoi K <koizumi.aoi@kyoko-project.wer.ee>

git-svn-id: file:///srv/svn/repo/kanako/trunk@4 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
This commit is contained in:
koizumi.aoi 2022-10-11 18:53:26 +00:00
parent a8ab186175
commit 9ad0255afb
3 changed files with 24 additions and 17 deletions

29
kanako
View File

@ -22,23 +22,19 @@ else
fi
fn_copy() {
fn_view $2 | ${clip}
fn_view $1 | ${clip_cmd}
}
fn_edit() {
${decrypt_cmd} ${decrypt_args} ${1%%.enc}.enc
${decrypt_cmd} ${decrypt_args} ${1%%.enc}.enc > ${1%%.enc}
${EDITOR} ${1%%.enc}
${encrypt_cmd} ${encrypt_args} ${1%%.enc}
${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc
rm ${1%%.enc}
}
fn_generate() {
pwgen -s ${1:-80}
}
fn_list() {
if command -v tree 2>/dev/null; then
tree ${store_dir}
else
ls -l ${store_dir}
fi
${list_cmd} ${store_dir}
}
fn_new() {
test -d $1 && fn_usage && exit 1
@ -47,9 +43,7 @@ fn_new() {
${EDITOR} ${tmpfile}
mkdir -p $(dirname $1)
${encrypt_cmd} ${encrypt_args} ${tmpfile}
mv ${tmpfile}.enc ${1%%.enc}.enc
${encrypt_cmd} ${encrypt_args} ${tmpfile} > ${1%%.enc}.enc
rm ${tmpfile}
}
fn_trash_directory() {
@ -61,10 +55,19 @@ fn_trash_entry() {
fn_usage() {
cat <<EOF
Usage:
ayu [-ceglnrRv] <arguments>
ayu [copy|edit|gen|list|add|trash|trashd|view] <arguments>
kanako [-ceglnrRv] <arguments>
kanako [copy|edit|gen|list|add|trash|trashd|view] <arguments>
EOF
}
fn_view() {
if [ -f ${1%%.enc}.enc ]; then
${encrypt_cmd} ${decrypt_args} ${1%%.enc}.enc
elif [ -d ${1:-.} ]; then
${list_cmd} ${1:-.}
else
fn_usage
fi
}
case $1 in
-c | copy) fn_copy $2 ;;

View File

@ -1,5 +1,7 @@
# [General]
#clip="xclip -i"
#clip="wl-copy --primary"
#list_cmd="tree"
# [Encryption]
## age

View File

@ -8,15 +8,17 @@
.Sh KEYS
.Ss General section
.Bl -tag -width 11n -compact
.It clip
Clipboard program to use with
the program. Default is xclip
.It clip_cmd
Clipboard executable to use with
the program.
.It list_cmd
Listing executable to use
with the program.
.El
.Ss Encryption section
.Bl -tag -width 11n -compact
.It encrypt_cmd
Command to handle encryption
Default is 'age'
.It encrypt_args
Options to be passed to
encrypt_cmd for encryption