Skip to content

Commit e6abca9

Browse files
author
Yu Leng (from Dev Box)
committed
Fix icon issues
1 parent 311b8ac commit e6abca9

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Command/ShellCommand.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public ShellCommand(string name, string value, BookmarkType type)
3636
BookmarkName = name;
3737
BookmarkType = type;
3838
BookmarkValue = value;
39+
Icon = IconHelper.GetIconByType(type);
40+
41+
Name = name;
3942

4043
// Icon = new IconInfo(IconFromUrl(Value, type));
4144
}

src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Helpers/BookmarkTypeHelper.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Text;
99
using System.Text.Json.Nodes;
1010
using System.Threading.Tasks;
11+
using Microsoft.CmdPal.Ext.Bookmarks.Models;
1112

1213
namespace Microsoft.CmdPal.Ext.Bookmarks.Helpers;
1314

@@ -20,17 +21,17 @@ public static string GetBookmarkChoices()
2021
new JsonObject
2122
{
2223
["title"] = "Web",
23-
["value"] = "Web",
24+
["value"] = BookmarkType.Web.ToString(),
2425
},
2526
new JsonObject
2627
{
2728
["title"] = "File",
28-
["value"] = "File",
29+
["value"] = BookmarkType.File.ToString(),
2930
},
3031
new JsonObject
3132
{
3233
["title"] = "Folder",
33-
["value"] = "Folder",
34+
["value"] = BookmarkType.Folder.ToString(),
3435
},
3536
};
3637

@@ -39,7 +40,7 @@ public static string GetBookmarkChoices()
3940
bookmarkChoices.Add(new JsonObject
4041
{
4142
["title"] = "pwsh",
42-
["value"] = "PWSH",
43+
["value"] = BookmarkType.PWSH.ToString(),
4344
});
4445
}
4546

@@ -48,7 +49,7 @@ public static string GetBookmarkChoices()
4849
bookmarkChoices.Add(new JsonObject
4950
{
5051
["title"] = "Windows PowerShell",
51-
["value"] = "PowerShell",
52+
["value"] = BookmarkType.PowerShell.ToString(),
5253
});
5354
}
5455

@@ -57,7 +58,7 @@ public static string GetBookmarkChoices()
5758
bookmarkChoices.Add(new JsonObject
5859
{
5960
["title"] = "Command Prompt",
60-
["value"] = "Cmd",
61+
["value"] = BookmarkType.Cmd.ToString(),
6162
});
6263
}
6364

@@ -66,7 +67,7 @@ public static string GetBookmarkChoices()
6667
bookmarkChoices.Add(new JsonObject
6768
{
6869
["title"] = "Python",
69-
["value"] = "python",
70+
["value"] = BookmarkType.Python.ToString(),
7071
});
7172
}
7273

@@ -75,7 +76,7 @@ public static string GetBookmarkChoices()
7576
bookmarkChoices.Add(new JsonObject
7677
{
7778
["title"] = "Python3",
78-
["value"] = "python3",
79+
["value"] = BookmarkType.Ptyhon3.ToString(),
7980
});
8081
}
8182

src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Models/BookmarkType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Microsoft.CmdPal.Ext.Bookmarks.Models;
66

77
public enum BookmarkType
88
{
9-
Web = 0,
9+
Web,
1010
File,
1111
Folder,
1212
PWSH,

src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Pages/AddBookmarkForm.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public override CommandResult SubmitForm(string payload)
8686
// get the name and url out of the values
8787
var formName = formInput["name"] ?? string.Empty;
8888
var formBookmark = formInput["bookmark"] ?? string.Empty;
89-
var hasPlaceholder = formBookmark.ToString().Contains('{') && formBookmark.ToString().Contains('}');
9089
var bookmarkTypeString = formInput["bookmarkType"]?.ToString() ?? string.Empty;
9190

9291
// Determine the type of the bookmark

0 commit comments

Comments
 (0)