You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support seamless pipelining of related cmdlets #63
Many related PowerShell cmdlets are designed to operate off of a common datatype in order to support pipelining, e.g.
Get-ChildItem ..|Remove-Item
So Get-ChildItem outputs a [System.IO.FileInfo] object and Remove-Item is designed to populate it's input either from a [System.IO.FileInfo] object or by explicit named parameter.
The cmdlets in this module should support a similar paradigm, so that related cmdlets can be seamlessly piped to each other, as PowerShell users would expect, e.g.
It was an oversight at the time when I did a refresh of the module. Luckily, adding-in pipeline support is totally possible (as Daniel described). If you're interested in helping out Andy De George (@Thraka), we'd love any contributions.
Actually, I started thinking about this some more after having looked at your #193 and Simon Heather (@X-Guardian)'s #205. I think this can be done in a pretty natural way. I started experimenting over here:
I think we should be explicitly adding consistently named properties to all objects that we're returning. For instance, if it's an object somehow related to a specific repo, then is should have a RepositorUrlNoteProperty on it. Then we can use your ValueFromPipelineByPropertyName trick with the added [Alias('RepositoryName')] on Uri so that just about any object pipelined into another function can auto-extract the relevant OwnerName/RepositoryName from that Uri. Additionally, if the object being returned has its own ID (like an Issue or Release), then we should be adding an explicit IssueId or ReleaseId property to those objects. That way, the [Alias] for those functions can really be explicit to avoid mistaken casting from a bad pipeline (so, for instance, we wouldn't use number like you do above for Issue.
Activity
Thraka commentedon Jan 24, 2019
I'm really surprised this wasn't designed from the ground up to be built like this. I mean, it's PowerShell, that's the whole point 😄
HowardWolosky commentedon Jan 24, 2019
It was an oversight at the time when I did a refresh of the module. Luckily, adding-in pipeline support is totally possible (as Daniel described). If you're interested in helping out Andy De George (@Thraka), we'd love any contributions.
Thraka commentedon Jan 25, 2019
I'm not a powershell design expert at all 😄 I still design my powershell like it's C#/.net code
TylerLeonhardt commentedon Jun 2, 2020
The reality is, it's hard. This module should try to do the least amount of work as possible over the GitHub API because if that changes, this breaks.
Additionally, I'm sure that Howard Wolosky (@HowardWolosky) doesn't want to be in the business of writing types/classes for all the GitHub outputs.
Take a look at how I did pipelining in #193
The idea is, using the power of parameter aliases and
ValueFromPipelineByPropertyNameto allow the output of some cmdlets to pipe into others.HowardWolosky commentedon Jun 4, 2020
Actually, I started thinking about this some more after having looked at your #193 and Simon Heather (@X-Guardian)'s #205. I think this can be done in a pretty natural way. I started experimenting over here:
HowardWolosky/PowerShellForGitHub@c1e88b6
I think we should be explicitly adding consistently named properties to all objects that we're returning. For instance, if it's an object somehow related to a specific repo, then is should have a
RepositorUrlNotePropertyon it. Then we can use yourValueFromPipelineByPropertyNametrick with the added[Alias('RepositoryName')]onUriso that just about any object pipelined into another function can auto-extract the relevantOwnerName/RepositoryNamefrom thatUri. Additionally, if the object being returned has its own ID (like an Issue or Release), then we should be adding an explicitIssueIdorReleaseIdproperty to those objects. That way, the[Alias]for those functions can really be explicit to avoid mistaken casting from a bad pipeline (so, for instance, we wouldn't usenumberlike you do above forIssue.Adding complete Pipeline support to the entire module (#242)