diff options
author | Anastasios Grammenos <anastasios.grammenos@noris.gr> | 2020-10-30 14:51:40 +0200 |
---|---|---|
committer | Anastasios Grammenos <anastasios.grammenos@noris.gr> | 2020-10-30 14:51:40 +0200 |
commit | 154f093999178bd98dc8e893f0ea95e57df77d4b (patch) | |
tree | f9c19ad2a56d1753b0095b1d96e9f97b8b9c267f | |
parent | fe9c54c24affd5c741031cf0c5f0bdf3c4fff31a (diff) | |
download | conf-154f093999178bd98dc8e893f0ea95e57df77d4b.tar.gz conf-154f093999178bd98dc8e893f0ea95e57df77d4b.tar.bz2 conf-154f093999178bd98dc8e893f0ea95e57df77d4b.zip |
edit: handle dumb terminal
-rwxr-xr-x | conf | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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 |