diff --git a/help/commandline.md b/help/commandline.md index 42253fcec03..52718aa7307 100644 --- a/help/commandline.md +++ b/help/commandline.md @@ -1,3 +1,71 @@ +# FAKE Command Line + +**Note: This documentation is for FAKE.exe version 2.18 or later.** + +The FAKE.exe command line interface (CLI) is defined as follows: + +`fake.exe [] [] [options]` + +## Basic Examples + +**No arguments:** `fake.exe` (FAKE will try and locate your build script). + +**Specify build script only:** `fake.exe mybuildscript.fsx` + +**Specify target name only:** `fake.exe clean` (runs the `clean` target). + +**Specify build script and target:** `fake.exe mybuildscript.fsx clean` + +## `buildScriptPath` + +Optional. The path to your `.fsx` build file. If not specified, FAKE will pick the first `.fsx` it finds in your working directory (and fail if none exist). + +## `targetName` + +Optional. The name of the build script target you wish to run. This will any target you specified to run in the build script. + +## Options + +Options begin with -- (long name) or - (short name). + +### `--envvar [-ev] ` + +Set environment variable name value pair. Supports multiple. + +### `--envflag [-ef] ` + +Set environment variable flag name to 'true'. Supports multiple. + +### `--logfile [-lf] ` + +Set the build output log file path. + +### `--printdetails [-pd]` + +Print details of FAKE's activity. + +### `--version [-v]` + +Print FAKE version information. + +### `--fsiargs [-fa] ` + +Pass args after this switch to FSI when running the build script. This consumes all arguments after it. See [F# Interactive Options](http://msdn.microsoft.com/en-us/library/dd233172.aspx) for the fsi CLI details. + +Important: If you use this option, you must include your build script path as one of the fsi args. For example: + +`--fsiargs --debug+ buildscript.fsx someArg1 anotherArg2` + +### `--boot [-b] ` + +Boostrapp your FAKE script. A bootstrapping `build.fsx` script executes twice (in two stages), allowing you to download dependencies with NuGet and do other preparatory work in the first stage, and have these dependencies available in the second stage. + +### `--help [-h|/h|/help|/?]` + +Display CLI help. + + + # Running FAKE targets from the command line For this short sample we assume you have the latest version of FAKE in *./tools/*. Now consider the following small FAKE script: diff --git a/src/app/FAKE/Cli.fs b/src/app/FAKE/Cli.fs index 3efde12a3c8..3f23f0d1f6b 100644 --- a/src/app/FAKE/Cli.fs +++ b/src/app/FAKE/Cli.fs @@ -13,8 +13,8 @@ type FakeArg = | [] LogFile of string | [] PrintDetails | [] Version - | [] FsiArgs of string - | [] Boot of string + | [] [] FsiArgs of string + | [] [] Boot of string interface IArgParserTemplate with member x.Usage = match x with @@ -24,7 +24,7 @@ type FakeArg = | PrintDetails _ -> "Print details of FAKE's activity." | FsiArgs _ -> "Pass args after this switch to FSI when running the build script." | Version _ -> "Print FAKE version information." - | Boot _ -> "TBC" + | Boot _ -> "Boostrapp your FAKE script." /// Return the parsed FAKE args or the parse exception. let parsedArgsOrEx args = @@ -37,9 +37,13 @@ let parsedArgsOrEx args = /// Prints the FAKE argument usage. let printUsage () = printfn @" - fake.exe [] [] [switches] + fake.exe [] [] [options] - Switches: + scriptPath: Optional. Path to your FAKE build script. If not specified, FAKE will use the first .fsx file in the working directory and fail if none exists. + + targetName: Optional. Name of the target you wish to run. This will override the target you specifed to run in the build script. + + Options: %s" (UnionArgParser().Usage()) type Args = { Script: string option; Target: string option; Rest: string [] }