From 6970e983c37e048f242c8a236ef5d7b193943602 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Tue, 30 May 2023 12:02:35 +1000 Subject: [PATCH 1/3] add Context.setExecutionContextFromCommandLineArgs --- src/app/Fake.Core.Context/Context.fs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/Fake.Core.Context/Context.fs b/src/app/Fake.Core.Context/Context.fs index 62bb790921d..561a3edf39c 100644 --- a/src/app/Fake.Core.Context/Context.fs +++ b/src/app/Fake.Core.Context/Context.fs @@ -193,3 +193,14 @@ module Context = invalidOp "no Fake Execution context was found. You can initialize one via Fake.Core.Context.setExecutionContext" | RuntimeContext.Fake e -> e + + /// + /// Creates and sets the FAKE execution context from command line arguments. + /// + let setExecutionContextFromCommandLineArgs scriptFile: unit = + System.Environment.GetCommandLineArgs() + |> Array.skip 2 // skip fsi & scriptFile + |> Array.toList + |> FakeExecutionContext.Create false scriptFile + |> RuntimeContext.Fake + |> setExecutionContext From abb119b341831521e94d9a54e98d27ea4facea7b Mon Sep 17 00:00:00 2001 From: Richard Webb Date: Sun, 21 Jul 2024 00:13:38 +0100 Subject: [PATCH 2/3] Run fantomas --- src/app/Fake.Core.Context/Context.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/Fake.Core.Context/Context.fs b/src/app/Fake.Core.Context/Context.fs index 561a3edf39c..9687364a871 100644 --- a/src/app/Fake.Core.Context/Context.fs +++ b/src/app/Fake.Core.Context/Context.fs @@ -197,7 +197,7 @@ module Context = /// /// Creates and sets the FAKE execution context from command line arguments. /// - let setExecutionContextFromCommandLineArgs scriptFile: unit = + let setExecutionContextFromCommandLineArgs scriptFile : unit = System.Environment.GetCommandLineArgs() |> Array.skip 2 // skip fsi & scriptFile |> Array.toList From 4051d9eaaf139049a1d31a46ba7d7cf4eab2cb32 Mon Sep 17 00:00:00 2001 From: Richard Webb Date: Sat, 27 Jul 2024 09:59:42 +0100 Subject: [PATCH 3/3] update release notes --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 18e726cfaba..2d3708b7866 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -5,6 +5,7 @@ * ENHANCEMENT: Added shorthash to git functions, thanks @voronoipotato - https://github.com/fsprojects/FAKE/pull/2752 * ENHANCEMENT: Support for `/tl:[auto:on:off]` msbuild flag, thanks @smoothdeveloper - https://github.com/fsprojects/FAKE/pull/2768 * ENHANCEMENT: Fixes for usage in .NET 8.0 enviroment projects. +* ENHANCEMENT: Add Context.setExecutionContextFromCommandLineArgs, thanks @cataggar - https://github.com/fsprojects/FAKE/pull/2750 ## 6.0.0 - 2023-02-20 * ENHANCEMENT: Site UI fixes and documentation link fixes.