feat(git-provider): Add basic GitRepo provider
This commit is contained in:
parent
6ae34b3c83
commit
e6665a588b
1 changed files with 52 additions and 0 deletions
52
src/PowershellModule/Git/GitProvider.cs
Normal file
52
src/PowershellModule/Git/GitProvider.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
using System;
|
||||||
|
using System.Management.Automation;
|
||||||
|
using System.Management.Automation.Provider;
|
||||||
|
|
||||||
|
namespace PowershellModule.Git;
|
||||||
|
|
||||||
|
// https://learn.microsoft.com/en-us/powershell/scripting/developer/provider/accessdbprovidersample02?view=powershell-7.6
|
||||||
|
[CmdletProvider(Name, ProviderCapabilities.None)]
|
||||||
|
public class GitProvider : NavigationCmdletProvider
|
||||||
|
{
|
||||||
|
public const string Name = "GitRepo";
|
||||||
|
|
||||||
|
public GitProvider()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override PSDriveInfo NewDrive(PSDriveInfo drive)
|
||||||
|
{
|
||||||
|
if (drive.Root != string.Empty)
|
||||||
|
{
|
||||||
|
throw new Exception("Drive root must be an empty string");
|
||||||
|
}
|
||||||
|
return base.NewDrive(drive);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void NewItem(string path, string itemTypeName, object newItemValue)
|
||||||
|
{
|
||||||
|
base.NewItem(path, itemTypeName, newItemValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override PSDriveInfo RemoveDrive(PSDriveInfo drive)
|
||||||
|
{
|
||||||
|
return base.RemoveDrive(drive);
|
||||||
|
}
|
||||||
|
|
||||||
|
// I think this is needed to be able to cd into it
|
||||||
|
protected override bool IsItemContainer(string path)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// I think this is needed to be able to cd into it
|
||||||
|
protected override bool ItemExists(string path)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool IsValidPath(string path)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue