"Clone in Windows" button - how it works?
github
Solution
Look at this patch of GitExtension: it register that action in HKCR
<Component Id="Protocol.github_windows" Guid="*">
<RegistryKey Key="github-windows" Root="HKCR">
<RegistryValue Value="URL: Github for Windows Protocol" Type="string" />
<RegistryValue Name="URL Protocol" Value="" Type="string" />
</RegistryKey>
<RegistryKey Key="github-windows\DefaultIcon" Root="HKCR">
<RegistryValue Value="[INSTALLDIR]GitExtensions.exe" Type="string" />
</RegistryKey>
<RegistryKey Root="HKCR" Key="github-windows\shell"/>
<RegistryKey Root="HKCR" Key="github-windows\shell\open"/>
<RegistryKey Root="HKCR" Key="github-windows\shell\open\command">
<RegistryValue Value=""[INSTALLDIR]GitExtensions.exe" %1" Type="string" />
</RegistryKey>
</Component>
And it adds:
if (args[1].StartsWith("git://"))
{
args = new string[]{args[0], "clone", args[1]};
}
if (args[1].StartsWith("github-windows://openRepo/"))
{
args = new string[]{args[0], "clone", args[1].Replace("github-windows://openRepo/", "")};
}
GitHub for Windows would go for a similar approach.
Problem
I am curious to how the button works. Can you explain how when I click the "Clone in Windows" button it knows to open a local application(GitHub) on my machine.