Skip to content

Commit

Permalink
126
Browse files Browse the repository at this point in the history
  • Loading branch information
beiranvand-karim committed Oct 6, 2024
1 parent daa9770 commit c46a140
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using notepad_plus_plus_file_management.Interfaces;

namespace notepad_plus_plus_file_management
{
public class CommandSwitcher(
ICommandLineArgs commandLineArgs,
IProcessManager processManager
) : ICommandSwitcher
{
private readonly ICommandLineArgs commandLineArgs = commandLineArgs;
private readonly IProcessManager processManager = processManager;

public string GetCommand()
{
string command = commandLineArgs.GetByKey("--command");
return command;
}

public void Run()
{
if (GetCommand() == "open")
{
processManager.Run();
}
}
}

public interface ICommandSwitcher
{
public string GetCommand();
public void Run();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static void Main(string[] args)
.UseSerilog()
.Build();

var svc = ActivatorUtilities.CreateInstance<ProcessManager>(host.Services);
var svc = ActivatorUtilities.CreateInstance<CommandSwitcher>(host.Services);
svc.Run();
}

Expand Down

0 comments on commit c46a140

Please sign in to comment.