commit e1d96a0d1ed8463525670331c6cbf91b5fc31eb1 parent f5ce40be79d42124daaf7119d7b04f443187c9be Author: hhvn <hayden@haydenvh.com> Date: Mon, 1 Feb 2021 09:25:32 +0000 bin/interface.sh: add multi-line pasting ability and cancellation for editing profile Diffstat:
M | bin/interface.sh | | | 16 | +++++++++++----- |
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/bin/interface.sh b/bin/interface.sh @@ -261,13 +261,19 @@ menu_users(){ [ "$nick" != "" ] && userset "$user" nick "$nick" prompt "Edit bio (${k}y${s}es/${k}n${s}o/from ${k}u${s}ri)" edit [ "$edit" = "y" ] && { - printf '' >$datadir/profile/$user - info "Type EOF by itself on a line to finish the profile" - while prompt "" line + info "Type ctrl+d to finish the profile" + cat > $datadir/profile/$user.new + save="" + while [ "$save" != "y" ] && [ "$save" != "n" ] do - [ "$line" = "EOF" ] && break - echo "$line" >> $datadir/profile/$user + prompt "Save mesage (${k}y${s}/${k}n${s})" save done + [ "$save" = "n" ] && { + info "didn't save profile" + anykey + break + } + cp $datadir/profile/$user.new $datadir/profile/$user } [ "$(echo "$edit" | grep -o '^.')" = "u" ] && curl "$(echo "$edit" | sed 's/^.//' | tr -d ' ')" > $datadir/profile/$user ok "profile updated"