Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Apr 7, 2018
1 parent 64d871f commit 263be76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions help/markdown/core-commandlineparsing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Fake.Core.CommandLineParsing

This module is a re-implementation from https://github.com/docopt/docopt.fs/ but with strong ordering.
This module is a fork from https://github.com/docopt/docopt.fs/ but with strong ordering.
The strong ordering enables you to have a nice CLI on your script or to write your own fake 5 modules with a CLI.

Example `script.fsx`:
Expand All @@ -22,7 +22,7 @@ options:
"""
// retrieve the fake 5 context information
let ctx = Fake.Core.Context.forceFakeContext ()
let ctx = Context.forceFakeContext ()
// get the arguments
let args = ctx.Arguments
let parser = Docopt(cli)
Expand All @@ -36,6 +36,17 @@ match DocoptResult.tryGetArgument "-m" results with
| Some arg -> printfn "%s" arg
```

A more sophisticated example can be in the fake runner: https://github.com/fsharp/FAKE/blob/64d871f5065412fe7b233025e454ccf3b89e46d7/src/app/Fake.netcore/Program.fs#L204-L259

Or the target module:

- https://github.com/fsharp/FAKE/blob/rc_1/src/app/Fake.Core.Target/Target.fs#L9-L26
- https://github.com/fsharp/FAKE/blob/64d871f5065412fe7b233025e454ccf3b89e46d7/src/app/Fake.Core.Target/Target.fs#L564-L619

You can also take a look at the test-suite:

- https://github.com/fsharp/FAKE/blob/rc_1/src/test/Fake.Core.CommandLine.UnitTests/Fake.Core.CommandLine.fs

## Differences to the python reference Docopt implementation

- The parser doesn't differentiate between arguments with and without `-` with regards to ordering. They are subject to the same rules as other arguments. The only exception is when defining multiple arguments like `[-a -b -c]`, then the ordering of the group doesn't matter.
Expand Down
4 changes: 2 additions & 2 deletions help/markdown/fake-commandline.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Ordering of arguments does MATTER. This is a change in behavior from FAKE versio

Examples:

- `fake run -v build.fsx` - This will not run fake in verbose mode. Instead it will try to run the script named `-v`.
- `fake --fsiargs "--define:BOOTSTRAP" build.fsx` - This will not run `build.fsx` and define BOOTSTRAP, because `--fsiargs` needs to follow after the script-name
- `fake run -v build.fsx` - This will not run fake in verbose mode. Instead it will try to run the script named `-v`. (But we might support that in the future)
- `fake build.fsx --fsiargs "--define:BOOTSTRAP"` - This will not run `build.fsx` and define BOOTSTRAP, because `--fsiargs` needs to be before the script-name.
- `fake build -s` - This will run fake in single-target mode and not in silent mode, you need to use `fake -s build` as described in the above usage description.

## `--verbose [-v]`
Expand Down

0 comments on commit 263be76

Please sign in to comment.