Skip to content

Commit

Permalink
Fix the completion script to show a message if no session file is found
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertAudi committed Jun 2, 2019
1 parent 61b4164 commit 21c4cf4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions share/zsh/_tsm
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ esac

case "$line[1]" in
show|remove|rename|copy|duplicate|restore|resume)
local sessions_dir
local -a session_files
session_files=("${TSM_SESSIONS_DIR}"/*.txt(.NOmf:gu+r::t:r))
sessions_dir="${TSM_SESSIONS_DIR:-${TSM_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/tsm}/sessions}"
session_files=("${sessions_dir}"/*.txt(.NOmf:gu+r::t:r))

_values 'Sessions' $session_files && ret=0
if (( ${#session_files} == 0 )); then
_message -e 'no sessions found' && ret=1
else
_values 'Sessions' $session_files && ret=0
fi
;;
help)
_describe -t commands 'tsm commands' cmds && ret=0
Expand Down

0 comments on commit 21c4cf4

Please sign in to comment.