Files
modules/testsuite/modulefiles/function/1.0
Xavier Delaruelle ef576c5fd9 Trim function body passed to set-function cmd
Trim any whitespace, newline or ';' characters at the beginning or end
of the function body passed to set-function modulefile command to
correctly define shell function whatever the writing style used.
2018-12-24 13:59:13 +01:00

57 lines
1.2 KiB
Plaintext

#%Module1.0
##############################################################################
# Modules Revision 3.0
# Providing a flexible user environment
#
# File: function/%M%
# Revision: %I%
# First Edition: 2018/10/14
# Last Mod.: %U%, %G%
#
# Authors: nanobowers <nanobowers@gmail.com>
#
# Description: Testsuite modulefile
# Command:
# Sub-Command: set-function
#
# Comment: %C{
# Check how some function argument variables are translated
# }C%
#
##############################################################################
if {[module-info shelltype] == "fish" } then {
set-function testsuite {eval (echo cd $argv[1])}
} else {
set-function testsuite {eval $(echo cd $1)}
}
# test other writing styles
if {[module-info shelltype] == "fish" } then {
set-function testsuite2 {
echo $argv[1]
}
set-function testsuite3 {
echo $argv[1];
}
set-function testsuite4 {echo $argv[1];}
set-function testsuite5 {
echo $argv[1]
echo $argv[2]
; }
} else {
set-function testsuite2 {
echo $1
}
set-function testsuite3 {
echo $1;
}
set-function testsuite4 {echo $1;}
set-function testsuite5 {
echo $1
echo $2
; }
}