Repository navigation
Description
Summary
The -Repository parameter should accept the combined owner/repo (e.g. PSModule/GitHub) format as input, automatically splitting it into the -Owner and -Repository values.
Current behavior
Owner and repository are supplied as two separate parameters:
Get-GitHubRepository -Owner 'PSModule' -Name 'GitHub'
Get-GitHubRelease -Owner 'PSModule' -Repository 'GitHub'Passing -Repository 'PSModule/GitHub' today does not resolve the owner - the value is treated as a literal repository name.
Desired behavior
Allow the full name to be passed to the repository parameter and have it parsed:
# These should be equivalent
Get-GitHubRelease -Repository 'PSModule/GitHub'
Get-GitHubRelease -Owner 'PSModule' -Repository 'GitHub'When the repository value contains a /, the segment before the slash populates Owner and the segment after becomes the repository name. A plain repository name (no slash) must keep working exactly as it does today, and an explicitly provided -Owner should take precedence / or be conflict-checked against the prefix.
Rationale
- Matches the widely used
owner/repoconvention (e.g. theghCLI's-R owner/repo,actions/checkout, git remotes). - Fewer parameters to pass for the common case; easier copy/paste from URLs and logs.
- Nicer pipeline ergonomics when a single string identifies the repo.
Implementation notes / suggestions
- An
ArgumentTransformationAttribute(or a shared helper) on the repository parameter could split on the first/and setOwnerwhen it is not already bound. - Apply consistently across all functions exposing
-Owner/-Repository(and the-Namevariant on*-GitHubRepository). - Validation: reject values with more than one
/, and decide behavior when both a prefixed repository and an explicit-Ownerare given (recommend: error on mismatch). - Add tests covering: plain name,
owner/repo, explicit-Owner+ plain name, and the conflict case.
Acceptance criteria
-
-Repository 'owner/repo'resolves owner + repo across the affected commands. - Plain
-Repository 'repo'/-Name 'repo'behavior is unchanged (backward compatible). - Conflicting explicit
-Owner+ prefixed repository is handled predictably (documented). - Tests and help/docs updated.
Activity