From c2115cd68914acb53012410de5b112a914f02d3f Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Thu, 1 Feb 2018 18:33:15 +0000 Subject: more set-screen features --- bin/set-screen | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/set-screen b/bin/set-screen index edecc26..57bdd59 100755 --- a/bin/set-screen +++ b/bin/set-screen @@ -24,6 +24,15 @@ function make_display_state_dir() { dir="$(display_state_dir)" mkdir -p "$dir" echo "Created $dir" + if [[ -n "$1" ]]; then + local srccmd="${CONFIG_DIR}/$1/command" + if [[ -x "$srccmd" ]]; then + ln -s "$srccmd" "$dir/command" && \ + echo "Linked <$1> command" + else + echo "<$1> command is not there, ignoring" + fi + fi } function run_display_state_commands() { @@ -49,6 +58,7 @@ $0 -- re-configure screens Usage: $0 make create directory for current state + $0 which show directory for current state $0 set execute 'command' script in directory for current state $0 same as 'set' $0 help show this text @@ -56,7 +66,8 @@ EOF } case "$1" in - 'make') make_display_state_dir ;; + 'make') make_display_state_dir "$2" ;; + 'which') display_state_dir ;; '' | 'set') run_display_state_commands ;; 'help' | '--help' ) print_usage ; exit 0 ;; *) >&2 print_usage; exit 1 ;; -- cgit v1.2.3