Added initialization script, added error checking on kanako, update

manual page.

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

git-svn-id: file:///srv/svn/repo/kanako/trunk@3 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
This commit is contained in:
koizumi.aoi 2022-10-11 17:38:29 +00:00
parent 6be4bf2c44
commit a8ab186175
4 changed files with 31 additions and 7 deletions

21
kanako
View File

@ -4,9 +4,22 @@ conf_dir=${conf_dir:-$HOME/.config/kanako}
key_dir=${key_dir:-$HOME/.kanako}
store_dir=${store_dir:-$HOME/.kanako-store}
cd ${store_dir} || exit 1
if test -d ${store_dir}; then
cd ${store_dir}
else
echo "Password store not found!"
echo "Please run kanako-init"
exit 1
fi
. ${conf_dir}/kanako.conf
if test -f ${conf_dir}/kanako.conf; then
. ${conf_dir}/kanako.conf;
else
echo "Configuration file has not been found!"
echo "Copy kanako.conf.example from the repository,"
echo "and edit accordingly."
exit 1
fi
fn_copy() {
fn_view $2 | ${clip}
@ -49,14 +62,14 @@ fn_usage() {
cat <<EOF
Usage:
ayu [-ceglnrRv] <arguments>
ayu [copy|edit|generate|list|add|trash|trashdir|view] <arguments>
ayu [copy|edit|gen|list|add|trash|trashd|view] <arguments>
EOF
}
case $1 in
-c | copy) fn_copy $2 ;;
-e | edit) fn_edit $2 ;;
-g | generate) fn_generate $2 ;;
-g | gen) fn_generate $2 ;;
-l | list) fn_list ;;
-n | add) fn_new $2 ;;
-r | trash) fn_trash $2 ;;

10
kanako-init Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
conf_dir="$HOME/.config/kanako"
key_dir="$HOME/.kanako"
store_dir="$HOME/.kanako-store"
echo "Initializing kanako(1)"
for i in $conf_dir $key_dir $store_dir; do
mkdir -p $i
done

View File

@ -14,13 +14,13 @@ Add a new entry
Copy an entry's text to the clipboard
.It edit, -e
Edit an entry
.It generate, -g
.It gen, -g
Generate a random password
.It list, -l
List all entries
.It del, -r
.It trash, -r
Remove single entries
.It delr, -R
.It trashd, -R
Remove recursively a directory w/ entries
.It view, -v
View an entry

1
mkfile
View File

@ -4,5 +4,6 @@ install:
install -Dm0755 kanako $PREFIX/bin/kanako
install -Dm0644 kanako.mdoc $PREFIX/share/man/man1/kanako.1
install -Dm0644 kanako.conf.mdoc $PREFIX/share/man/man5/kanako.conf.5
install -Dm0755 kanako-init $PREFIX/bin/kanako-init
uninstall:
rm -f $PREFIX/bin/kanako $PREFIX/share/man/man1/kanako.1 $PREFIX/share/man/man5/kanako.conf.5