mirror of
https://github.com/envmodules/modules.git
synced 2026-06-18 00:06:53 +08:00
77 lines
1.9 KiB
Plaintext
77 lines
1.9 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])}
|
|
} 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
|
|
; }
|
|
}
|
|
|