Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to clarify CLI --help #2667

Merged
merged 5 commits into from
Jul 22, 2022
Merged

Conversation

mlaily
Copy link
Contributor

@mlaily mlaily commented Apr 19, 2022

Description

Try to fix most of my concerns with the CLI --help (see #2666)

  • boy scout rule: "leave the code behind in a better state than you found it" (fix warnings, obsolete members or code-style in the places you worked in)

Here is the result of fake --help after this PR:

FAKE 5 - F# Make (5.22.0)


Usage:
  fake [fake_opts] run [run_opts] [<script.fsx>] [--] [<scriptargs>...]
  fake [fake_opts] build [build_opts] [--] [<scriptargs>...]
  fake --version
  fake --help | -h

Note `fake build` is basically equivalent to calling `fake run` with a script named `build.fsx`.

Fake options [fake_opts]:
  -v, --verbose [*]        Verbose (can be used multiple times)
                           Is ignored if -s is used.
                           * -v: Log verbose but only for FAKE
                           * -vv: Log verbose for Paket as well
  -s, --silent             Be silent.
                           Use this option if you need to pipe your output into another tool or need some additional processing.

Fake Run options [run_opts]:
  -d, --debug              Debug the script.
  -n, --nocache            Disable Fake cache for this run.
  -p, --partial-restore
                           Only restore the required group instead of a full restore,
                           can be set globally by setting the environment variable FAKE_PARTIAL_RESTORE to true.
  --fsiargs <fsiargs> [*]  Arguments passed to the F# interactive.

Fake Build options [build_opts]:
  -d, --debug              Debug the script.
  -n, --nocache            Disable Fake cache for this run.
  -p, --partial-restore
                           Only restore the required group instead of a full restore,
                           can be set globally by setting the environment variable FAKE_PARTIAL_RESTORE to true.
  --fsiargs <fsiargs> [*]  Arguments passed to the F# interactive.
  -f, --script <script.fsx>
                           The script to execute (defaults to `build.fsx`).


 ----- SCRIPT ARGUMENTS SECTION -----

Remaining arguments following the previously defined options are provided to the script.

Each script might understand different arguments,
but since there are good chances you are using the 'Fake.Core.Target' package,
its command-line is documented below.

THIS SECTION ONLY APPLIES IF YOU USE THE 'Fake.Core.Target' PACKAGE IN YOUR SCRIPT!

You can use the following arguments in place of `<scriptargs>`:

(`fake-run` refers to the Fake command and arguments defined above)

Usage:
  fake-run --list
  fake-run --write-info <file>
  fake-run --version
  fake-run --help | -h
  fake-run [target_opts] [target <target>] [--] [<targetargs>...]

Target Module options [target_opts]:
    -t, --target <target>    Run the given target (ignored if a target is already provided with '[target <target>]')
    -e, --environment-variable <keyval> [*]
                             Set an environment variable. Use 'key=val'.
                             Consider using regular arguments, see https://fake.build/core-targets.html
    -s, --single-target      Run only the specified target.
    -p, --parallel <num>     Run parallel with the given number of tasks.

 ----- END OF SCRIPT ARGUMENTS SECTION -----

Warning:

Ordering of arguments does MATTER.
`fake -v run script.fsx` executes `script.fsx` in verbose mode.
`fake run -v script.fsx` will try to execute a script named '-v' and fail.

If a script argument/option conflicts with any of the options allowed before,
you need to separate script options with `--`.
The reverse is also true: to print all targets, you can use
`fake build --list` instead of `fake build -- --list`
because `--list` doesn't conflict with any of the [build_opts].

Basic examples:

Specify script file and execute default script action:
    fake run mybuildscript.fsx

Specify script file and run the Clean target:
    fake run build.fsx --target Clean
or shorter version using the default build.fsx script:
    fake build -t Clean

make it easier for newcomers.

-- RUNTIME ARGUMENTS SECTION --
FAKE 5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clean-up and organizing the help message!
I would like to suggest that we automate this and get the version of the current FAKE-CLI and print it instead of
hard-coding it as FAKE 5

@yazeedobaid
Copy link
Collaborator

Also, the failing test in the build has been fixed now, could you please rebase your branch from release/next?

@mlaily
Copy link
Contributor Author

mlaily commented Apr 25, 2022

Hello, thank you for your feedback.

I used the existing dynamic Environment.fakeVersionStr string (though FAKE 5 is still hardcoded in that part^^') as you suggested, and did the rebase.

I updated this PR's description with how the new --help looks with these changes.
It looks a bit more like dotnet -h now, which is nice.

@yazeedobaid
Copy link
Collaborator

Hi thanks for the PR
Could you please rebase your branch from release/next? Now that the build has been fixed.

@mlaily
Copy link
Contributor Author

mlaily commented Jul 18, 2022

Hi! Done!

@yazeedobaid yazeedobaid added the in-review Convey that a PR is in-review status label Jul 21, 2022
Copy link
Collaborator

@yazeedobaid yazeedobaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR

@yazeedobaid yazeedobaid merged commit 38c8777 into fsprojects:release/next Jul 22, 2022
@mlaily
Copy link
Contributor Author

mlaily commented Jul 22, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-review Convey that a PR is in-review status
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants