Changeset 14 in code for trunk


Ignore:
Timestamp:
Nov 26, 2022, 2:15:17 PM (3 years ago)
Author:
koizumi.aoi
Message:

Update configuration format, add switch to install(1) in mkfile

Signed-off-by: Aoi K <koizumi.aoi@…>

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/kanako

    r12 r14  
    1 #!/bin/sh -e
     1#!/bin/sh
     2# $KyokoNet: kanako,v 1.7 2022/11/26 08:44:11 akoizumi Exp $
    23
    34readonly kanako_conf_dir="${kanako_conf_dir:-$HOME/.config/kanako}"
     
    2324
    2425fn_copy() {
    25     fn_view $1 | "${clip_cmd}"
     26    fn_view $1 | "${kanako_clip_cmd}"
    2627}
    2728fn_edit() {
    28     ${encrypt_cmd} ${decrypt_args} ${1%%.enc}.enc > ${1%%.enc}
     29    ${kanako_encrypt_cmd} ${kanako_decrypt_args} ${1%%.enc}.enc > ${1%%.enc}
    2930    "${EDITOR}" "${1%%.enc}"
    30     ${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc
     31    ${kanako_encrypt_cmd} ${kanako_encrypt_args} ${1%%.enc} > ${1%%.enc}.enc
    3132    rm "${1%%.enc}"
    3233}
    3334fn_list() {
    34     "${list_cmd}" "${store_dir}"
     35    "${kanako_list_cmd}" "${kanako_store_dir}/"
    3536}
    3637fn_new() {
     
    4142
    4243    mkdir -p "$(dirname "$1")"
    43     ${encrypt_cmd} ${encrypt_args} ${tmpfile} > ${1%%.enc}.enc
     44    ${kanako_encrypt_cmd} ${kanako_encrypt_args} ${tmpfile} > ${1%%.enc}.enc
    4445    rm ${tmpfile}
    4546}
    4647fn_trash_directory() {
    47     rm -rf $@
     48    rm -rf "$@"
    4849}
    49 fn_trash_entry() {
     50fn_trash_file() {
    5051    rm -f "${1}${2}".enc
    5152}
    5253fn_usage() {
    53     cat <<EOF
    54 Usage:
    55 kanako [-celnrRv] <arguments>
    56 EOF
     54    printf "Usage: %s [-c|-e|-h|-l|-n|-R|-r|-v [file or directory]]\n" "$0"
     55    printf "The arguments for all switches except for '-h' are relative to\n"
     56    printf "\t\$kanako_store_dir which is set to %s\n\n" "{$kanako_store_dir}"
    5757}
    5858fn_view() {
    5959    if [ -f "${1%%.enc}".enc ]; then
    60         ${encrypt_cmd} ${decrypt_args} "${1%%.enc}".enc
     60        ${kanako_encrypt_cmd} ${kanako_decrypt_args} "${1%%.enc}".enc
    6161    elif [ -d "${1:-.}" ]; then
    62         ${list_cmd} "${1:-.}"
     62        ${kanako_list_cmd} "${1:-.}"
    6363    else
    6464        fn_usage
     
    7171    -l) fn_list ;;
    7272    -n) fn_new $2 ;;
    73     -r) fn_trash_entry $2 ;;
    7473    -R) fn_trash_directory $2 ;;
     74    -r) fn_trash_file $2 ;;
    7575    -v) fn_view $2 ;;
    7676    *) fn_usage ;;
  • trunk/kanako.conf.example

    r13 r14  
    11# Configuration file for kanako(1)
    22
    3 #clip="xclip -i"
    4 #clip="wl-copy --primary"
    5 #list_cmd="tree"
     3#kanako_clip_cmd="xclip -i"
     4#kanako_clip_cmd="wl-copy --primary"
     5#kanako_list_cmd="tree"
    66
    77## age
    8 #encrypt_cmd="age"
    9 #encrypt_args="-e -R ${key_dir}/pub.age --armor"
    10 #decrypt_args="-d -i ${key_dir}/priv.age"
     8#kanako_encrypt_cmd="age"
     9#kanako_encrypt_args="-e -R ${kanako_key_dir}/pub.key --armor"
     10#kanako_decrypt_args="-d -i ${kanako_key_dir}/priv.key"
    1111
    1212## cream
    13 #encrypt_cmd="cream"
    14 #encrypt_args="-e -f"
    15 #decrypt_args="-d"
     13#kanako_encrypt_cmd="cream"
     14#kanako_encrypt_args="-e -f"
     15#kanako_decrypt_args="-d"
    1616
    1717## gpg
    18 #encrypt_cmd="gpg"
    19 #encrypt_args="-e --recipient ${key_dir}/pub.gpg"
    20 #decrypt_args="-d"
     18#kanako_encrypt_cmd="gpg"
     19#kanako_encrypt_args="-e --recipient ${kanako_key_dir}/pub.key"
     20#kanako_decrypt_args="-d"
    2121
    2222## salty
    23 #encrypt_cmd="salty"
    24 #encrypt_args="-e -r $(cat ${key_dir}/pub.slt)"
    25 #decrypt_args="-d -i ${key_dir}/priv.slt"
     23#kanako_encrypt_cmd="salty"
     24#kanako_encrypt_args="-e -r $(cat ${kanako_key_dir}/pub.slt)"
     25#kanako_decrypt_args="-d -i ${kanako_key_dir}/priv.slt"
  • trunk/kanako.conf.mdoc

    r4 r14  
    1 .Dd Bureaucracy 65, 3188
     1.Dd Bureaucracy 73, 3188
    22.Dt KANAKO.CONF 5
    33.Os
     
    1010.Bl -tag -width 11n -compact
    1111.It clip_cmd
    12 Clipboard executable to use with
    13 the program.
     12Clipboard manager command
     13.It debug
     14Controls whether to use debug
     15mode or not. Any value other
     16than false is interpreted as
     17true.
    1418.It list_cmd
    15 Listing executable to use
    16 with the program.
     19Command used to print a listing
     20of the password store
     21.It menu_cmd
     22Menu command for kanako_menu
    1723.El
    1824.Ss Encryption section
  • trunk/kanako.mdoc

    r11 r14  
    1 .Dd Bureaucracy 72, 3188
     1.Dd Bureaucracy 73, 3188
    22.Dt KANAKO 1
    33.Os
     
    55.Nm kanako
    66.Nd the adaptable password manager
     7.Sh SYNOPSIS
     8.Nm
     9.Fl c
     10.Ar args
     11.Nm
     12.Fl e
     13.Ar args
     14.Nm
     15.Fl l
     16.Nm
     17.Fl n
     18.Ar args
     19.Nm
     20.Fl r
     21.Ar args
     22.Nm
     23.Fl R
     24.Ar args
     25.Nm
     26.Fl v
     27.Ar args
    728.Sh DESCRIPTION
    8 
     29It is a clean rewrite of
     30.Xr ayu 1
     31supporting multiple backends
     32and having more add-ons for
     33use with it. However, it
     34may be pretty unstable compared
     35to said tool, but should work
     36well for its purpose.
    937.Sh USAGE
    1038.Bl -tag -width 11n -compact
     
    2755.Sh SEE ALSO
    2856.Xr age 1
     57.Xr cream 1
    2958.Xr gpg 1
    3059.Xr kanako.conf 5
  • trunk/mkfile

    r11 r14  
    55
    66install-bin:
    7         install -m$EXEC_MODE kanako $PREFIX/bin/kanako
     7        install -Dm$EXEC_MODE kanako $PREFIX/bin/kanako
    88install-examples:
    9         install -m$FILE_MODE kanako.conf.example $PREFIX/share/examples/kanako/kanako.conf
     9        install -Dm$FILE_MODE kanako.conf.example $PREFIX/share/examples/kanako/kanako.conf
    1010install-man:
    11         install -m$FILE_MODE kanako.mdoc $PREFIX/share/man/man1/kanako.1
    12         install -m$FILE_MODE kanako.conf.mdoc $PREFIX/share/man/man5/kanako.conf.5
     11        install -Dm$FILE_MODE kanako.mdoc $PREFIX/share/man/man1/kanako.1
     12        install -Dm$FILE_MODE kanako.conf.mdoc $PREFIX/share/man/man5/kanako.conf.5
    1313uninstall-bin:
    1414        rm -f $PREFIX/bin/kanako
Note: See TracChangeset for help on using the changeset viewer.