Repository navigation
Get-VisioPage: -ID is a real page ID, new -Index takes positions (#232) - #234
Merged
Merged
Conversation
Get-VisioPage -ID treated its numbers as 1-based positions (Pages[id]) while the docs, the cmdlet's own comment and Get-VisioShape -ID all mean a real ID, so a real Page.ID gave the wrong page or threw (-ID 0 threw although the first page of a new document has ID 0). -ID now uses Pages.ItemFromID. A new -Index parameter, in its own pagebyindex set, takes the 1-based positions the old behavior accepted, so a script that used -ID as a position only needs to change the parameter name. 9 new tests (6 failed before the change). Behavior change, noted in the module changelog. Remaining test counts, CLAUDE.md and the docs backlog entry are updated. Closes #232 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #232, in the direction agreed there:
Get-VisioPage -IDbecomes a real page ID lookup, and a new-Indexparameter takes positions, so the two meanings are explicit.-IDnow usesPages.ItemFromID, the wayGet-VisioShape -IDdoes for shapes. The docs, the cmdlet's own comment and thePageIDcolumn ofGet-VisioPageCellsalready meant a real ID. Before, a realPage.IDgave the wrong page or threw:-ID 0threw although the first page of a new document has ID 0.-Index <int[]>(new, its ownpagebyindexset) takes 1-based positions, matching Visio's page numbering. These are exactly the numbers the old-IDaccepted, so a script that used-IDas a position only needs to change the parameter name. (The other cmdlets'-Indexparameters are zero-based, but they index rows in a shape's data, not pages.)-ID,-Index,-Nameand-ActivePagecannot be combined.Behavior change
Anyone relying on
-IDas a position (including the old docs exampleGet-VisioPage -ID 1,3) gets different pages. The module changelog says so plainly and tells them to switch to-Index. A minor version bump for the module is appropriate.Testing
PageCmdletBindingTests; 6 of them failed against the old code. They cover real-ID lookup (including ID 0 and several IDs, and IDs that differ from positions),-Indexpositions, out-of-range values failing in the lookup rather than in binding, and the parameter-set clashes.Also
VisioPowerShell/CHANGELOG.md[Unreleased]: Added and Changed entries.docs/TESTING.md,CLAUDE.mdand the Models docs backlog entry (the Visio PowerShell docs note is release-gated) are updated.visiops_v4_docs).Closes #232
🤖 Generated with Claude Code