diff --git a/cross-application-feature-development-management/scripts/environment-variables-template-files/notepadpp-open-all.env.template b/cross-application-feature-development-management/scripts/environment-variables-template-files/notepadpp-open-all.env.template index 021abd4c..4553163f 100644 --- a/cross-application-feature-development-management/scripts/environment-variables-template-files/notepadpp-open-all.env.template +++ b/cross-application-feature-development-management/scripts/environment-variables-template-files/notepadpp-open-all.env.template @@ -4,4 +4,5 @@ NOTEPADDPP_EXECUTE_FILE_LOCATION= FEATURE_NAME= HOSTING_DIRECTORY= HOST_APPLICATION_NAME= -GUEST_APPLICATION_NAME= \ No newline at end of file +GUEST_APPLICATION_NAME= +COMMAND= \ No newline at end of file diff --git a/cross-application-feature-development-management/scripts/powershell-scripts/notepadpp-open-all.ps1 b/cross-application-feature-development-management/scripts/powershell-scripts/notepadpp-open-all.ps1 index a9b7fb1c..2a318544 100644 --- a/cross-application-feature-development-management/scripts/powershell-scripts/notepadpp-open-all.ps1 +++ b/cross-application-feature-development-management/scripts/powershell-scripts/notepadpp-open-all.ps1 @@ -5,6 +5,6 @@ get-content "notepadpp-open-all.env" | ForEach-Object { set-content env:\$name $value } Push-Location $env:NOTEPAD_PLUS_PLUS_FILE_MANAGEMENT_EXECUTIVE_FILE_CONTAINING_DIRECTORY -$ArgumentList = "--notepaddpp-execute-file-location $env:NOTEPADDPP_EXECUTE_FILE_LOCATION --feature-name $env:FEATURE_NAME --hosting-directory $env:HOSTING_DIRECTORY --host-application-name $env:HOST_APPLICATION_NAME --guest-application-name $env:GUEST_APPLICATION_NAME" +$ArgumentList = "--command $env:COMMAND --notepaddpp-execute-file-location $env:NOTEPADDPP_EXECUTE_FILE_LOCATION --feature-name $env:FEATURE_NAME --hosting-directory $env:HOSTING_DIRECTORY --host-application-name $env:HOST_APPLICATION_NAME --guest-application-name $env:GUEST_APPLICATION_NAME" start-process -FilePath $env:NOTEPAD_PLUS_PLUS_FILE_MANAGEMENT_EXECUTIVE_FILE_LOCATION -ArgumentList $ArgumentList Pop-Location \ No newline at end of file diff --git a/dotnet/notepad-plus-plus-file-management/terminal/notepad-plus-plus-file-management/CommandSwitcher.cs b/dotnet/notepad-plus-plus-file-management/terminal/notepad-plus-plus-file-management/CommandSwitcher.cs new file mode 100644 index 00000000..f1f26264 --- /dev/null +++ b/dotnet/notepad-plus-plus-file-management/terminal/notepad-plus-plus-file-management/CommandSwitcher.cs @@ -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(); + } +} \ No newline at end of file diff --git a/dotnet/notepad-plus-plus-file-management/terminal/notepad-plus-plus-file-management/Program.cs b/dotnet/notepad-plus-plus-file-management/terminal/notepad-plus-plus-file-management/Program.cs index bd8f8501..08225e08 100644 --- a/dotnet/notepad-plus-plus-file-management/terminal/notepad-plus-plus-file-management/Program.cs +++ b/dotnet/notepad-plus-plus-file-management/terminal/notepad-plus-plus-file-management/Program.cs @@ -46,7 +46,7 @@ private static void Main(string[] args) .UseSerilog() .Build(); - var svc = ActivatorUtilities.CreateInstance(host.Services); + var svc = ActivatorUtilities.CreateInstance(host.Services); svc.Run(); }