Changeset 29 in code for trunk


Ignore:
Timestamp:
Jun 29, 2025, 1:50:48 AM (5 weeks ago)
Author:
yakumo.izuru
Message:

誤った仮定に頼るのをやめなさい

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/README.md

    r24 r29  
    1111* [dd(1)](https://man.netbsd.org/dd.1)
    1212* [oathtool(1)](https://www.nongnu.org/oath-toolkit/)
     13* [openssl(1)](https://www.openssl.org)
    1314* [rm(1)](https://man.netbsd.org/rm.1)
    14 * [strings(1)](https://man.netbsd.org/strings.1)
    15 * [tr(1)](https://man.netbsd.org/tr.1)
    1615* [tree(1)](https://github.com/Old-Man-Programmer/tree)
    1716
  • trunk/kanako

    r28 r29  
    11#!/bin/sh
    2 # $YakumoLabs: kanako,v 2.3 2025/05/14 02:07:06 yakumo_izuru Exp $
     2# $YakumoLabs: kanako,v 2.4 2025/05/18 14:59:46 yakumo_izuru Exp $
    33
    44kanako_conf_dir="${kanako_conf_dir:-$HOME/.config/kanako}"
     
    2323        view "$1" | "${kanako_clip_cmd}"
    2424}
     25delf() {
     26        _warn "Will be removing $1"
     27        _warn "Are you okay with that?"
     28        read junk
     29        case ${junk} in
     30        n | N) _info "Abort" ;;
     31        y | Y) [ test -d "${1}" ] && _die "${1} is a directory, use $0 -R" || rm -f "${1}.enc" && _info "Removed $1/$2" ;;
     32        esac
     33}
     34delr() {
     35        _warn "Will be removing $1"
     36        _warn "Are you okay with that?"
     37        _warn "[y/n]"
     38        read junk
     39        case ${junk} in
     40        n | N) _info "Abort" ;;
     41        y | Y) rm -rf "${1}" && _info "Removed $1" ;;
     42        esac
     43}
    2544edit() {
    2645        if [ -f ${1%%.enc}.enc ]; then
     
    3453}
    3554gen() {
    36         printf "%s\n" $(strings </dev/urandom | dd bs=1 count="${1:-30}" 2>/dev/null | tr -d ' \t\n\r')
     55        printf "%s\n" $(openssl rand -hex "${1:-30}")
    3756}
    3857list() {
     
    6483        fi
    6584}
    66 delete_directory() {
    67         _warn "Will be removing $1"
    68         _warn "Are you okay with that?"
    69         read junk
    70         case ${junk} in
    71                 n | N) _info "Abort" ;;
    72                 y | Y) rm -rf "${1}" && _info "Removed $1" ;;
    73         esac
    74 }
    75 delete_file() {
    76         _warn "Will be removing $1"
    77         _warn "Are you okay with that?"
    78         read junk
    79         case ${junk} in
    80                 n | N) _info "Abort" ;;
    81                 y | Y) rm -f "${1}.enc" && _info "Removed $1/$2" ;;
    82         esac
    83 }
    8485usage() {
    8586        _info "Usage: kanako [-ceglnorRv] args"
     
    107108        -n) new ${arg} ;;
    108109        -o) otp ${arg} ;;
    109         -r) delete_file ${arg} ;;
    110         -R) delete_directory ${arg} ;;
     110        -r) delf ${arg} ;;
     111        -R) delr ${arg} ;;
    111112        -v) view ${arg} ;;
    112113        *) usage ;;
Note: See TracChangeset for help on using the changeset viewer.