diff options
| author | Vadym Kochan <vadim4j@gmail.com> | 2020-07-01 09:24:24 +0300 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2020-07-11 15:27:19 +0200 |
| commit | f34f6d968e711f3cab019a12bb60da1bbf52161f (patch) | |
| tree | 17ef1ecf11e9f8e3c3479ebb85d8f00015c368ab /vis-open | |
| parent | 861c0fc66b65aa4bc60b9d04b40a405ca25490aa (diff) | |
| download | vis-f34f6d968e711f3cab019a12bb60da1bbf52161f.tar.gz vis-f34f6d968e711f3cab019a12bb60da1bbf52161f.tar.xz | |
vis-open: add trailing "/" for the folders
Add trailing "/" for the folder entries which allows to easy
differentiate folders and the regular files. Additionally it allows
easy filter only folders by simply enter "/" in the vis-open prompt.
Signed-off-by: Vadym Kochan <vadim4j@gmail.com>
Diffstat (limited to 'vis-open')
| -rwxr-xr-x | vis-open | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -8,6 +8,15 @@ NL=' VIS_MENU_PROMPT="" ALLOW_AUTO_SELECT=1 +wrap_dirs() { + local o + + while read o + do + [ -d "$o" ] && printf "%s/\n" "$o" || printf "%s\n" "$o" + done +} + while [ $# -gt 0 ]; do case "$1" in -h|--help) @@ -63,7 +72,7 @@ fi # At this point, we have a bunch of options we need to present to the # user so they can pick one. -CHOICE=$(printf "%s\n" "$@" | vis-menu -b -p "$VIS_MENU_PROMPT") +CHOICE=$(printf "%s\n" "$@" | wrap_dirs | vis-menu -b -p "$VIS_MENU_PROMPT") # Did they pick a file or directory? Who knows, let's let the next iteration figure it out. exec "$0" -p "$VIS_MENU_PROMPT" -- "$CHOICE" |
