Changeset 4 in code for trunk


Ignore:
Timestamp:
Oct 11, 2022, 6:53:26 PM (3 years ago)
Author:
koizumi.aoi
Message:

Fix bugs, update docs

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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/kanako

    r3 r4  
    2323
    2424fn_copy() {
    25     fn_view $2 | ${clip}
     25    fn_view $1 | ${clip_cmd}
    2626}
    2727fn_edit() {
    28     ${decrypt_cmd} ${decrypt_args} ${1%%.enc}.enc
     28    ${decrypt_cmd} ${decrypt_args} ${1%%.enc}.enc > ${1%%.enc}
    2929    ${EDITOR} ${1%%.enc}
    30     ${encrypt_cmd} ${encrypt_args} ${1%%.enc}
     30    ${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc
    3131    rm ${1%%.enc}
    3232}
     
    3535}
    3636fn_list() {
    37     if command -v tree 2>/dev/null; then
    38         tree ${store_dir}
    39     else
    40         ls -l ${store_dir}
    41     fi
     37    ${list_cmd} ${store_dir}
    4238}
    4339fn_new() {
     
    4844
    4945    mkdir -p $(dirname $1)
    50     ${encrypt_cmd} ${encrypt_args} ${tmpfile}
    51 
    52     mv ${tmpfile}.enc ${1%%.enc}.enc
     46    ${encrypt_cmd} ${encrypt_args} ${tmpfile} > ${1%%.enc}.enc
    5347    rm ${tmpfile}
    5448}
     
    6256    cat <<EOF
    6357Usage:
    64 ayu [-ceglnrRv] <arguments>
    65 ayu [copy|edit|gen|list|add|trash|trashd|view] <arguments>
     58kanako [-ceglnrRv] <arguments>
     59kanako [copy|edit|gen|list|add|trash|trashd|view] <arguments>
    6660EOF
     61}
     62fn_view() {
     63    if [ -f ${1%%.enc}.enc ]; then
     64        ${encrypt_cmd} ${decrypt_args} ${1%%.enc}.enc
     65    elif [ -d ${1:-.} ]; then
     66        ${list_cmd} ${1:-.}
     67    else
     68        fn_usage
     69    fi   
    6770}
    6871
  • trunk/kanako.conf.example

    r2 r4  
    11# [General]
    22#clip="xclip -i"
     3#clip="wl-copy --primary"
     4#list_cmd="tree"
    35
    46# [Encryption]
  • trunk/kanako.conf.mdoc

    r2 r4  
    99.Ss General section
    1010.Bl -tag -width 11n -compact
    11 .It clip
    12 Clipboard program to use with
    13 the program. Default is xclip
     11.It clip_cmd
     12Clipboard executable to use with
     13the program.
     14.It list_cmd
     15Listing executable to use
     16with the program.
    1417.El
    1518.Ss Encryption section
     
    1720.It encrypt_cmd
    1821Command to handle encryption
    19 Default is 'age'
    2022.It encrypt_args
    2123Options to be passed to
Note: See TracChangeset for help on using the changeset viewer.