diff options
Diffstat (limited to 'trunk')
-rwxr-xr-x | trunk/src/mkbuild | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild index 2c40aa5..a61a059 100755 --- a/trunk/src/mkbuild +++ b/trunk/src/mkbuild @@ -104,6 +104,8 @@ ${red}DESCRIPTION${normal} edit a mkbuild ${red}-wc${normal}, ${red}--working-copy${normal} create an unversioned mkbuild working copy + ${red}--get-param-copy${normal} + get a parameter from a given mkbuild ${red}EXAMPLES${normal} ${red}mkbuild -sa pyrex.mkbuild${normal} @@ -242,6 +244,12 @@ function set_parameters { ACTION='working_copy' break # we need to break otherwise specific arguments are evalued ;; + '--get-param') + # Get parameter for a given mkbuild + set_mkbuild_name $2 + ACTION='get_param' + break # we need to break otherwise specific arguments are evalued + ;; '-d'|'--debug') # Debug mode set -x @@ -1706,6 +1714,19 @@ function working_copy { } +function get_param { + + # get a parameter from a mkbuild file + # usage: get_param <parameter> + + local parameter="`echo $* | tr '[:lower:]' '[:upper:] | tr -d '"' | tr -d "'"'`" + + if [ -e "$MKBUILD_NAME" ]; then + grep -e "\[\[$parameter\]\]" $MKBUILD_NAME | cut -d = -f 2 | tr -d '"' | tr -d "'" + fi + +} + # ---------------------------------------------------------------- #============================= @@ -1811,6 +1832,10 @@ case $ACTION in 'working_copy') working_copy ;; + 'get_param') + shift 2 + get_param $* + ;; esac # Clear temporary files |