diff --git a/Makefile b/Makefile index bcdf6b8..3fd0dfd 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,11 @@ PREFIX ?= /usr/local +fmt: + shfmt -p -w rin + install: install -Dm0755 rin ${PREFIX}/bin/rin - install -Dm0600 rin.1 ${PREFIX}/man/man1/rin.1 + install -Dm0600 rin.1 ${PREFIX}/share/man/man1/rin.1 uninstall: rm -f ${PREFIX}/bin/rin rm -f ${PREFIX}/man/man1/rin.1 diff --git a/README b/README index d547241..9d025ea 100644 --- a/README +++ b/README @@ -1,8 +1,29 @@ -Rin (燐) +RIN(1) FreeBSD General Commands Manual RIN(1) + +NAME + rin – My personal e-mail assistant, named after Rin Kaenbyou (aka Orin) + +SYNOPSIS + rin [check] [clean] [fetch] [list] account + +DESCRIPTION + It is a script that uses fdm(1) and mblaze(7) adapted to my configuration + +USAGE + check account + Check for mail in the server + + clean account + Clean up the Maildir directory + + fetch account + Fetch mail from the remote server + + list account + List messages on a Maildir + +AUTHORS + Izuru Yakumo + +FreeBSD 13.3-RELEASE July 25, 2024 FreeBSD 13.3-RELEASE -Usage: -rin clean -rin compose -rin fetch -rin list -rin read diff --git a/rin b/rin index 227f024..b5499da 100644 --- a/rin +++ b/rin @@ -1,47 +1,61 @@ #!/bin/sh -# rin - my personal e-mail assistant in posix shell -# it's a wrapper over fdm(1) and mblaze(7) adapted to my setup -# which can be found on https://gt.kalli.st/novaburst/home-v2 +# $TheSupernovaDuo$ +# (o)rin - my personal e-mail assistant in posix shell -# Source code: https://git.076.ne.jp/novaburst/mailutils-sh +# Source code: +# - https://gitler.moe/novaburst/orin +# - https://git.chaotic.ninja/yakumo.izuru/orin + +# Check for mail in the server +# Arguments: +fn_check() { + fdm -a "$@" poll 2>/dev/null + if [ $? -ne 0 ]; then + echo "ごめんなさい、できませんでした..." + exit 1 + fi +} # Clean-up the Maildir directory # Arguments: fn_clean() { - find "$@"/cur -type f -print -delete -} -# Compose/write an e-mail -# This is just here for some reason -fn_compose() { - mcom + find "$@"/cur -type f -print -delete } # Fetch e-mails from remote server # Arguments: fn_fetch() { - fdm -a "$@" fetch + echo "はい、すぐに!" + fdm -a "$@" fetch 2>/dev/null + if [ $? -ne 0 ]; then + echo "ごめんなさい、できませんでした..." + exit 1 + fi } # List messages on a Maildir # Arguments: fn_list() { - minc -q "$@" - mlist -s "$@" | msort -dr | mthread -r | mseq -S | mscan -} -# Read a message -# Arguments: -fn_read() { - mless "$2" + minc -q "$@" + mlist -s "$@" | msort -dr | mthread -r | mseq -S | mscan } # Print an usage note # Triggered if the assistant is called without any arguments. fn_usage() { - printf "Usage: \n" - printf "%s [ clean | compose | fetch | list | read ] \n" "$(basename $0)" + printf "usage: %s [ check | clean | fetch | list ] \n" "$(basename $0)" } case $1 in - clean | -c) fn_clean "$2" ;; - compose | -w) fn_compose ;; - fetch | -f) fn_fetch "$2" ;; - list | -l) fn_list "$2" ;; - read | -r) fn_read "$2" ;; - *) fn_usage ;; +check) + fn_check "$2" + ;; +clean) + fn_clean "$2" + ;; +fetch) + fn_fetch "$2" + ;; +list) + fn_list "$2" + ;; +*) + fn_usage + ;; esac diff --git a/rin.1 b/rin.1 index efe5458..5e75d59 100644 --- a/rin.1 +++ b/rin.1 @@ -1,29 +1,32 @@ -.Dd June 9, 2022 +.Dd July 25, 2024 .Dt RIN 1 .Os .Sh NAME .Nm rin -.Nd My personal e-mail assistant +.Nd My personal e-mail assistant, named after Rin Kaenbyou (aka "Orin") +.Sh SYNOPSIS +.Nm +.Op check +.Op clean +.Op fetch +.Op list +.Ar account .Sh DESCRIPTION -It's a wrapper over +It is a script that uses .Xr fdm 1 and .Xr mblaze 7 -adapted to my setup +adapted to my configuration .Sh USAGE -.Bl -tag -width 11n -compact -.It clean, -c -Clean-up a Maildir directory -.It compose, -w -Compose/write an e-mail -.It fetch, -f -Fetch e-mails from remote server -.It list, -l +.Bl -tag -width 6n +.It check Ar account +Check for mail in the server +.It clean Ar account +Clean up the Maildir directory +.It fetch Ar account +Fetch mail from the remote server +.It list Ar account List messages on a Maildir -.It read, -r -Read a message .El -.Sh SEE ALSO -.Lk https://gt.kalli.st/novaburst/home-v2 .Sh AUTHORS -.An Aoi Koizumi Aq Mt novaburst@kalli.st +.An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja