feat: Add GitRepoRegistration cmdlets #5
1 changed files with 9 additions and 2 deletions
feat(git-provider): Update Remove-GitRepoRegistration to work from any directory when -Name is given
commit
b91a868a54
|
|
@ -19,11 +19,18 @@ public class RemoveGitRepoRegistrationCommand : PSCmdlet
|
|||
{
|
||||
GitManager.SetDebugWriter(WriteDebug);
|
||||
|
||||
var repoFolder = GitManager.IsGitRepo(SessionState.Path.CurrentLocation.Path);
|
||||
// If we aren't given a value for the Name argument, default behaviour is to attempt to remove a registration
|
||||
// by the current git repo folder name for the current location.
|
||||
// If we have a name, don't bother testing for a git repo, just attempt to remove the registration by name
|
||||
// regardless of where we're being called from
|
||||
var registrationNameToRemove = string.IsNullOrEmpty(Name)
|
||||
? GitManager.IsGitRepo(SessionState.Path.CurrentLocation.Path).Folder
|
||||
: Name;
|
||||
|
||||
GitManager.Instance.UnregisterRepo(registrationNameToRemove);
|
||||
|
||||
// Removing a registration works similar to registering a new one - we either remove by exact name, or by
|
||||
// the folder if no name is given (so a user can remove a registration from a git repo they're currently in)
|
||||
GitManager.Instance.UnregisterRepo(Name ?? repoFolder.Folder);
|
||||
GitManager.ClearDebugWriter();
|
||||
|
||||
base.BeginProcessing();
|
||||
|
|
|
|||
Loading…
Reference in a new issue