Skip to content

Commit 79b8443

Browse files
feat: Move-Turtle using Script ( Fixes #351 )
1 parent 42b2fe5 commit 79b8443

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Commands/Move-Turtle.ps1

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ function Move-Turtle {
22
<#
33
.SYNOPSIS
44
Moves a turtle.
5-
.DESCRIPTION
5+
.DESCRIPTION
66
Moves a turtle by invoking a method with any number of arguments.
7+
8+
This represents a single movement of the turtle.
9+
10+
To move the turtle multiple times in one command, use `Get-Turtle`.
711
.EXAMPLE
812
New-Turtle |
913
Move-Turtle Forward 10 |
@@ -15,6 +19,10 @@ function Move-Turtle {
1519
Move-Turtle Forward 10 |
1620
Move-Turtle Right 90 |
1721
Save-Turtle "./Square.svg"
22+
.LINK
23+
Get-Turtle
24+
.LINK
25+
Set-Turtle
1826
#>
1927
[CmdletBinding(PositionalBinding=$false)]
2028
param(
@@ -64,7 +72,10 @@ function Move-Turtle {
6472
Write-Error "Method '$method' not found on Turtle object."
6573
return
6674
}
67-
68-
$inputMethod.Invoke($ArgumentList)
75+
76+
if ($inputMethod.Script) {
77+
$this = $InputObject
78+
& $inputMethod.Script @ArgumentList
79+
}
6980
}
7081
}

0 commit comments

Comments
 (0)