]> git.tuebingen.mpg.de Git - gsu.git/commitdiff
Merge branch 't/default_gsu_dir'
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 27 Sep 2014 22:59:43 +0000 (22:59 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 27 Sep 2014 22:59:43 +0000 (22:59 +0000)
Cooking for almost a month.

* t/default_gsu_dir:
  Unify gsu_dir handling.

config
gui
subcommand

diff --git a/config b/config
index 59086ed4e526817449025041486cd5d6d1e2a13b..0663e340fdcf26e5824d69ae8821081abcfa9206 100644 (file)
--- a/config
+++ b/config
@@ -79,7 +79,7 @@ gsu_check_options_or_die()
 }
 
 if [[ "$(type -t _gsu_setup)" != "function" ]]; then
-       gsu_dir=${gsu_dir:=${HOME:-}/.gsu}
+       gsu_dir=${gsu_dir:-${BASH_SOURCE[0]%/*}}
        . $gsu_dir/common || exit 1
        _gsu_setup
 fi
diff --git a/gui b/gui
index eb9f29f37c9e1d7aef03c96f08b4838285931f1a..72717a1ecd30750990073c86ceb47bc8f65604e6 100644 (file)
--- a/gui
+++ b/gui
@@ -1,8 +1,9 @@
 #!/bin/bash
 
-if [[ $(type -t gsu_is_a_number) != "function" ]]; then
-       GSU_DIR=${GSU_DIR:=${HOME:-}/.gsu}
-       . $GSU_DIR/common || exit 1
+if [[ "$(type -t _gsu_setup)" != "function" ]]; then
+       gsu_dir=${gsu_dir:-${BASH_SOURCE[0]%/*}}
+       . $gsu_dir/common || exit 1
+       _gsu_setup
 fi
 
 export GSU_NODE_NAME_PATTERN='[a-zA-Z_]'
@@ -200,7 +201,6 @@ gsu_gui()
 {
        local tree="$1" subtree
 
-       _gsu_setup
        type -t dialog &> /dev/null
        if (($? != 0)); then
                gsu_msg "dialog executable not found"
index 05860f68395f67ffd3e9a51a60e48eb857a9cca8..95e0ba9ebbc48aa5f8753d2e8fc42d8e594a26b7 100644 (file)
@@ -1,9 +1,10 @@
 #!/bin/bash
 # (C) 2006-2011 Andre Noll
 
-if [[ $(type -t gsu_is_a_number) != "function" ]]; then
-       GSU_DIR=${GSU_DIR:=${HOME-}/.gsu}
-       . $GSU_DIR/common || exit 1
+if [[ "$(type -t _gsu_setup)" != "function" ]]; then
+       gsu_dir=${gsu_dir:-${BASH_SOURCE[0]%/*}}
+       . $gsu_dir/common || exit 1
+       _gsu_setup
 fi
 
 _gsu_usage()
@@ -524,7 +525,6 @@ gsu_get_unnamed_arg_num()
 gsu()
 {
        local i
-       _gsu_setup
        _gsu_available_commands
        gsu_cmds="$result"
        if (($# == 0)); then