Skip to content

Commit d2bfebe

Browse files
committed
Add context menu arguments option for integrate command
1 parent 176dffa commit d2bfebe

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

SmartImage.Rdx/IntegrationCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Author: Deci | Project: SmartImage.Rdx | Name: IntegrationCommand.cs
22
// Date: 2024/05/22 @ 16:05:51
33

4+
using System.Diagnostics;
45
using SmartImage.Lib.Utilities;
56
using Spectre.Console.Cli;
67

@@ -15,7 +16,7 @@ public override int Execute(CommandContext context, IntegrationCommandSettings s
1516
// AConsole.WriteLine($"{AppUtil.IsContextMenuAdded}");
1617

1718
if (settings.ContextMenu.HasValue) {
18-
var rv = AppUtil.HandleContextMenu(settings.ContextMenu.Value);
19+
var rv = AppUtil.HandleContextMenu(settings.ContextMenu.Value, settings.ContextMenuArguments);
1920
AConsole.WriteLine($"Context menu change: {rv}");
2021
}
2122

SmartImage.Rdx/IntegrationCommandSettings.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Author: Deci | Project: SmartImage.Rdx | Name: IntegrationCommandSettings.cs
22
// Date: 2024/05/22 @ 16:05:47
33

4+
using SmartImage.Lib.Utilities;
5+
using Spectre.Console;
46
using Spectre.Console.Cli;
57

68
namespace SmartImage.Rdx;
@@ -11,4 +13,19 @@ internal class IntegrationCommandSettings : CommandSettings
1113
[CommandOption("--ctx-menu")]
1214
public bool? ContextMenu { get; internal set; }
1315

16+
[CommandOption("--ctx-menu-args")]
17+
public string? ContextMenuArguments { get; internal set; }
18+
19+
public override ValidationResult Validate()
20+
{
21+
if (AppUtil.IsWindows) {
22+
ContextMenuArguments ??= R1.Reg_Launch_Args;
23+
}
24+
else if (AppUtil.IsLinux) {
25+
ContextMenuArguments ??= R1.Linux_Launch_Args;
26+
}
27+
28+
return base.Validate();
29+
}
30+
1431
}

0 commit comments

Comments
 (0)