summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnastasios Grammenos <anastasios.grammenos@noris.gr>2020-10-30 14:51:40 +0200
committerAnastasios Grammenos <anastasios.grammenos@noris.gr>2020-10-30 14:51:40 +0200
commit154f093999178bd98dc8e893f0ea95e57df77d4b (patch)
treef9c19ad2a56d1753b0095b1d96e9f97b8b9c267f
parentfe9c54c24affd5c741031cf0c5f0bdf3c4fff31a (diff)
downloadconf-154f093999178bd98dc8e893f0ea95e57df77d4b.tar.gz
conf-154f093999178bd98dc8e893f0ea95e57df77d4b.tar.bz2
conf-154f093999178bd98dc8e893f0ea95e57df77d4b.zip
edit: handle dumb terminal
-rwxr-xr-xconf3
1 files changed, 3 insertions, 0 deletions
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