From 3a8a43ccdcb61d5e35ebf95c3730a4b0c7b922e5 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 2 Apr 2016 22:36:42 +0200 Subject: [PATCH] style: load_session: move return case up, removing indent --- lib/layout-helpers.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/layout-helpers.sh b/lib/layout-helpers.sh index 6f7491c..52488b4 100644 --- a/lib/layout-helpers.sh +++ b/lib/layout-helpers.sh @@ -202,26 +202,26 @@ load_session() { file="$1" fi - if [ -f "$file" ]; then - if [ $# -gt 1 ]; then - session="$2" - else - session="${1/%.session.sh}" - session="${session/%.sh}" - fi - - set_default_path=true - source "$file" - session= - - # Reset `$session_root`. - if [[ "$session_root" != "$HOME" ]]; then - session_root="$HOME" - fi - else + if ! [ -f "$file" ]; then echo "\"$1\" session layout not found." >&2 return 1 fi + + if [ $# -gt 1 ]; then + session="$2" + else + session="${1/%.session.sh}" + session="${session/%.sh}" + fi + + set_default_path=true + source "$file" + session= + + # Reset `$session_root`. + if [[ "$session_root" != "$HOME" ]]; then + session_root="$HOME" + fi } # Create a new session, returning 0 on success, 1 on failure.