Skip to content

Commit

Permalink
fsx,fsxc: deprecate --check/-k flag
Browse files Browse the repository at this point in the history
In the cases where launcher.sh is used (instead of fsx.fsproj),
the -k flag was being passed to fsxc successfully, but then the
script would be run. As fixing this would be a bit messy (would
need lots of bash hacks in the launcher), let's rather
deprecate it; and if someone needs to only compile the script,
they can call fsxc directly (which is what we advice in the
deprecation error message).

Fixes #37
  • Loading branch information
knocte committed Aug 26, 2023
1 parent a2b3c81 commit 2d86bd8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions fsx/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ let InjectBinSubfolderInPath(userScriptPath: string) =

let fsxcArgs, maybeUserScriptPath, userArgs = SplitArgsIntoFsxcArgsAndUserArgs()

if fsxcArgs.Any(fun arg -> arg = "--check" || arg = "-k") then
Console.Error.WriteLine(
"The flag --check/-k is DEPRECATED. "
+ FSX.Compiler.Program.CheckFlagDeprecationMessage
)

Environment.Exit 1

let fsxcMainArguments =
match maybeUserScriptPath with
| Some userScriptPath ->
Expand Down
12 changes: 10 additions & 2 deletions fsxc/Fsxc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ type ProgramInvocationType =
exception NoScriptProvided

module Program =
let CheckFlagDeprecationMessage =
"If you need to only compile (without running), use 'fsxc' instead of 'fsx'"

#if LEGACY_FRAMEWORK
let private nugetExeTmpLocation: Lazy<FileInfo> =
Expand Down Expand Up @@ -94,8 +96,14 @@ module Program =

Console.WriteLine " -h, --help Show this help"

Console.WriteLine
" -k, --check Only check if it compiles, removing generated binaries"
match invocationType with
| FsxcPureInvocation ->
Console.WriteLine
" -k, --check Only check if it compiles, removing generated binaries"
| FsxLauncherScript ->
Console.WriteLine(
" -k, --check DEPRECATED: " + CheckFlagDeprecationMessage
)

Console.WriteLine
" -v, --verbose Verbose mode, ideal for debugging purposes"
Expand Down

0 comments on commit 2d86bd8

Please sign in to comment.