From 154f093999178bd98dc8e893f0ea95e57df77d4b Mon Sep 17 00:00:00 2001 From: Anastasios Grammenos Date: Fri, 30 Oct 2020 14:51:40 +0200 Subject: edit: handle dumb terminal --- conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf b/conf index 450a65c..2ef73ba 100755 --- a/conf +++ b/conf @@ -147,6 +147,7 @@ function edit { matched+=( "${configs[$c]}" ) fi done + [ ${#matched[@]} -eq 1 ] && [ "${TERM}" == "dumb" ] && echo "${matched[0]}" && return 0 [ ${#matched[@]} -eq 1 ] && ${EDITOR} "${matched[0]}" && return 0 [ ${#matched[@]} -gt 1 ] && warn "Too many files, specify" && list -g "${1}" && return 1 @@ -156,12 +157,14 @@ function edit { matched+=( "${configs[$c]}" ) fi done + [ ${#matched[@]} -eq 1 ] && [ "${TERM}" == "dumb" ] && echo "${matched[0]}" && return 0 [ ${#matched[@]} -eq 1 ] && ${EDITOR} "${matched[0]}" && return 0 [ ${#matched[@]} -gt 1 ] && warn "Too many files, specify" && list -l | grep "${1}" && return 1 matched=() for c in "${!configs[@]}"; do if [ "${c}" == "$1" ]; then + [ "${TERM}" == "dumb" ] && echo "${configs[$c]}" && return 0 ${EDITOR} "${configs[$c]}" && return 0 fi done -- cgit v1.2.3