Last active
August 29, 2015 14:23
-
-
Save mastoj/2a47953915c2698b9419 to your computer and use it in GitHub Desktop.
FAKE question about parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
cls | |
"NuGet.exe" "Install" "FAKE" "-OutputDirectory" "packages" "-ExcludeVersion" | |
"packages\FAKE\tools\Fake.exe" build.fsx %* | |
pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// include Fake lib | |
#r @"packages/FAKE/tools/FakeLib.dll" | |
open Fake | |
open Fake.EnvironmentHelper | |
// Default target | |
Target "Default" (fun _ -> | |
trace "Hello World from FAKE" | |
) | |
Target "Clean" (fun _ -> | |
printfn "Name = %s %s" (environVar "first") (environVar "last") | |
trace "Cleaning up your trash" | |
) | |
Target "Random" (fun _ -> | |
printfn "Name = %s %s" (environVar "first") (environVar "last") | |
trace "It's not really random" | |
) | |
Target "What" (fun _ -> | |
printfn "Has build param WAT? %A" (hasBuildParam "WAT") | |
printfn "Has build param YO? %A" (hasBuildParam "YO") | |
printfn "Has build param YOLO? %A" (hasBuildParam "YOLO") | |
printfn "Name = %s %s" (environVar "first") (environVar "last") | |
trace "What happened?" | |
) | |
// start build | |
printfn "Build is starting, sit down and enjoy the ride!" | |
"Clean" | |
==> "Default" | |
==> "Random" | |
==> "What" | |
RunTargetOrDefault "Default" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.\build.cmd What -ev first john -ev last doe | |
Prints: | |
Has build param WAT? false | |
Has build param YO? false | |
Has build param YOLO? false | |
Name = john doe | |
As expected. But this | |
.\build.cmd What -ev first john -ev last doe WAT YO | |
prints: | |
Has build param WAT? true | |
Has build param YO? true | |
Has build param YOLO? false | |
Name = true true | |
And this prints what I expect | |
.\build.cmd What first=john last=doe WAT YO | |
Prints | |
Has build param WAT? true | |
Has build param YO? true | |
Has build param YOLO? false | |
Name = john doe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment