add posix man page display - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 045881a05309b02e07b9a0357869a99e1ac610e1 DIR parent 0cb8a1ec6853e1d6ca6edc67fd13b404488e9344 HTML Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Tue, 23 Feb 2021 17:36:21 +0100 add posix man page display not everyone has posix man pages installed, or wants to access the opengroup WWW page. Signed-off-by: Annna Robert-Houdin <annna@bitreich.org> Diffstat: M annna-start-services | 15 +++++++++++++++ 1 file changed, 15 insertions(+), 0 deletions(-) --- DIR diff --git a/annna-start-services b/annna-start-services @@ -276,6 +276,21 @@ annna_common() { annna-say -c "${channel}" "${user}, ${randomoneliner}" fi ;; + "${botname}, posex man "*|"${botname}, posix man "*) + exp="$(printf "%s\n" "${text}" | cut -c 18- | sed 's,\t, ,g')" + chapter=1 + case "${exp%% *}" in + 1|3) chapter="${exp%% *}"; exp="${exp#* }" ;; + esac + dresult="$(COLUMNS=80 man "${chapter}p" "${exp}")" + if [ "$dresult" ]; + then + puri="$(printf "%s" "${dresult}" | /br/bin/bitreich-paste)" + else + puri="No matches found." + fi + annna-say -c "${channel}" "${puri}" + ;; "${botname}, wolfram is "*) word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t, ,g')" case "$word" in