Skip to content

Commit

Permalink
feat: add dot command to GitUICommands (functional)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJithil committed May 4, 2021
1 parent 5e0f6ed commit ff63360
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion GitUI/CommandsDialogs/FormCommandlineHelp.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="_NO_TRANSLATE_commands.Text" xml:space="preserve">
<value>browse [path] [-filter=] [-commit=&lt;selectedSha&gt;[,&lt;firstSha&gt;]]
<value>.
browse [path] [-filter=] [-commit=&lt;selectedSha&gt;[,&lt;firstSha&gt;]]
about
add [filename]
addfiles [filename]
Expand Down
6 changes: 6 additions & 0 deletions GitUI/GitUICommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,12 @@ private bool RunCommandBasedOnArgument(IReadOnlyList<string> args, IReadOnlyDict
return StartCloneDialog(null, args[1].Replace("github-mac://openRepo/", ""), true);
}

// User supplied `.` as param. So, we need to open the current working directory.
if (args[1] == ".")
{
return StartBrowseDialog();
}

break;
}
#pragma warning restore SA1025 // Code should not contain multiple whitespace in a row
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,5 +363,14 @@ private static void ClickButton(Form form, string buttonName)

private static void SetText(Form form, string controlName, string value)
=> form.FindDescendantOfType<Control>(control => control.Name == controlName).Text = value;

[Test]
public void RunCommandBasedOnArgument_dot()
{
var selected = ObjectId.Random();
var first = ObjectId.Random();
var otherIgnored = ObjectId.Random();
RunCommandBasedOnArgument<FormBrowse>(new string[] { "ge.exe", "." });
}
}
}

0 comments on commit ff63360

Please sign in to comment.