mirror of
https://github.com/envmodules/modules.git
synced 2026-05-30 00:12:31 +08:00
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.
57 lines
1.2 KiB
Plaintext
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
|
|
; }
|
|
}
|
|
|