summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2018-02-01 18:33:15 +0000
committerGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2018-02-01 18:33:27 +0000
commitc2115cd68914acb53012410de5b112a914f02d3f (patch)
tree63ea82086b00376fd9e5faa21fc59d586736fea3
parentscript to guess how long an emerge will run (diff)
downloadmisc-scripts-c2115cd68914acb53012410de5b112a914f02d3f.tar.gz
misc-scripts-c2115cd68914acb53012410de5b112a914f02d3f.tar.bz2
misc-scripts-c2115cd68914acb53012410de5b112a914f02d3f.zip
more set-screen features
-rwxr-xr-xbin/set-screen13
1 files changed, 12 insertions, 1 deletions
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 ;;