Skip to content
Snippets Groups Projects
Commit 7b32e386 authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

mkexp: added example script 'share/doc/mkexp/mkexp.bash' with 'bash' shell utilities

parent 163a2e86
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ Global
* Changed merge of process environment ('DEFAULT' section) to be sorted
* Added tool 'duexp' to show disk usage by the given experiment
* Added 'key' option to getexp for querying a specific config value
* Added example script 'share/doc/mkexp/mkexp.bash' with 'bash' shell utilities
Release 1.0.0
=============
......
......@@ -101,7 +101,10 @@ except ExpConfigError as error:
if args.readme:
print(config['EXP_DESCRIPTION'])
elif args.key:
print(get_value(config, args.key));
try:
print(get_value(config, args.key));
except KeyError as error:
die("invalid config name '{0}'".format(error.message))
elif args.verbose >= 2:
config.indent_type = ' '
config.write(sys.stdout)
......
#
# Source this file for MakeExperiments! bash utilities
#
# Change to script directory ($SCRIPT_DIR) of a given .config.
# If no .config file is given, the 'update' file is sought and evaluated.
# '-d xxx' will change to $XXX_DIR instead of $SCRIPT_DIR
cdexp () {
local var=script dir cfg buffer vardir OPTIND
while getopts :d:h OPTOPT
do
case $OPTOPT in
d) var="$OPTARG";;
h) exec >&2
echo "Usage: cdexp [-d DIRSPEC] [-h] [CONFIG]"
echo
echo "DIRSPEC is converted to upper case and '_DIR' is added"
echo "If CONFIG is omitted, the 'update' file must be available"
return 0
;;
\?) echo "Oops: invalid option '$OPTARG'" >&2; return 1;;
esac
done
shift $((OPTIND - 1))
if [[ "$1" ]]
then
dir=$(dirname "$1")
cfg="$1"
elif [[ -f update ]]
then
eval $(awk '/^cd / {dir=$2; print "dir=" dir ";"}; /^exec / {print "cfg=" dir "/" $3}' update)
else
echo 'Oops: invalid number of parameters' >&2
return 1
fi
vardir=$(getexp -p "$dir" -k "${var^^}_DIR" "$cfg") &&
cd "$vardir"
}
......@@ -11,7 +11,7 @@ setup(
url = 'http://code.mpimet.mpg.de/projects/esmenv',
py_modules = ['configobj', 'validate', 'feedback', 'expconfig', 'files', 'package_info'],
scripts = ['mkexp', 'getexp', 'rmexp', 'diffexp', 'diffpath', 'cpexp', 'cppath'],
data_files = [('share/doc/'+package_info.name, ['doc/mkexp.pdf'])],
data_files = [('share/doc/'+package_info.name, ['doc/mkexp.pdf', 'mkexp.bash'])],
platforms = ['Posix'],
license = 'LICENSE.txt',
requires = ['Jinja2(>= 2.6)']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment