Skip to content

Commit

Permalink
add Context.setExecutionContextFromCommandLineArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
cataggar authored and xperiandri committed Jul 19, 2024
1 parent 7fc5737 commit c8135c9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/Fake.Core.Context/Context.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

/// <summary>
/// Creates and sets the FAKE execution context from command line arguments.
/// </summary>
let setExecutionContextFromCommandLineArgs scriptFile: unit =
System.Environment.GetCommandLineArgs()
|> Array.skip 2 // skip fsi & scriptFile
|> Array.toList
|> FakeExecutionContext.Create false scriptFile
|> RuntimeContext.Fake
|> setExecutionContext

0 comments on commit c8135c9

Please sign in to comment.