1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#%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])}
} elseif {[module-info shelltype] == "pwsh" } then {
set-function testsuite {
Param([Parameter(Mandatory=$true, Position=0)] [string] $arg1); Invoke-Expression (echo cd $arg1)
}
} 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]
; }
} elseif {[module-info shelltype] == "pwsh" } then {
set-function testsuite2 {
Param([Parameter(Mandatory=$true, Position=0)] [string] $arg1); echo $arg1
}
set-function testsuite3 {
Param([Parameter(Mandatory=$true, Position=0)] [string] $arg1); echo $arg1;
}
set-function testsuite4 {Param([Parameter(Mandatory=$true, Position=0)] [string] $arg1); echo $arg1;}
set-function testsuite5 {
Param(
[Parameter(Mandatory=$true, Position=0)] [string] $arg1,
[Parameter(Mandatory=$true, Position=1)] [string] $arg2
)
echo $arg1
echo $arg2
; }
} else {
set-function testsuite2 {
echo $1
}
set-function testsuite3 {
echo $1;
}
set-function testsuite4 {echo $1;}
set-function testsuite5 {
echo $1
echo $2
; }
}
|