feature: add more commands in command palette (#1937)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2026-03-05 14:36:02 +08:00
parent 3ec37a205b
commit 6241882b71
3 changed files with 52 additions and 2 deletions

View File

@@ -309,7 +309,7 @@
<x:String x:Key="Text.CreateTag.Name" xml:space="preserve">Tag Name:</x:String>
<x:String x:Key="Text.CreateTag.Name.Placeholder" xml:space="preserve">Recommended format: v1.0.0-alpha</x:String>
<x:String x:Key="Text.CreateTag.PushToAllRemotes" xml:space="preserve">Push to all remotes after created</x:String>
<x:String x:Key="Text.CreateTag.Title" xml:space="preserve">Create New Tag</x:String>
<x:String x:Key="Text.CreateTag.Title" xml:space="preserve">Create Tag</x:String>
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">Kind:</x:String>
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">annotated</x:String>
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">lightweight</x:String>

View File

@@ -82,6 +82,56 @@ namespace SourceGit.ViewModels
_launcher.OpenCommandPalette(sub);
}));
_cmds.Add(new($"{App.Text("Repository.NewBranch")}...", "Branch.Add", () =>
{
var repo = _repo;
_launcher.CancelCommandPalette();
repo.CreateNewBranch();
}));
_cmds.Add(new($"{App.Text("CreateTag.Title")}...", "Tag.Add", () =>
{
var repo = _repo;
_launcher.CancelCommandPalette();
repo.CreateNewTag();
}));
_cmds.Add(new($"{App.Text("Fetch.Title")}...", "Fetch", async () =>
{
var repo = _repo;
_launcher.CancelCommandPalette();
await repo.FetchAsync(false);
}));
_cmds.Add(new($"{App.Text("Pull.Title")}...", "Pull", async () =>
{
var repo = _repo;
_launcher.CancelCommandPalette();
await repo.PullAsync(false);
}));
_cmds.Add(new($"{App.Text("Push.Title")}...", "Push", async () =>
{
var repo = _repo;
_launcher.CancelCommandPalette();
await repo.PushAsync(false);
}));
_cmds.Add(new($"{App.Text("Stash.Title")}...", "Stashes.Add", async () =>
{
var repo = _repo;
_launcher.CancelCommandPalette();
await repo.StashAllAsync(false);
}));
_cmds.Add(new($"{App.Text("Apply.Title")}...", "Diff", () =>
{
var repo = _repo;
_launcher.CancelCommandPalette();
repo.ApplyPatch();
}));
_cmds.Sort((l, r) => l.Label.CompareTo(r.Label));
_visibleCmds = _cmds;
_selectedCmd = _cmds[0];
}

View File

@@ -50,7 +50,7 @@
<ListBox Grid.Row="2"
x:Name="CmdListBox"
MaxHeight="250"
MaxHeight="400"
Margin="4,0"
BorderThickness="0"
SelectionMode="Single"