Skip to content

Commit

Permalink
fsxc: add --debug flag
Browse files Browse the repository at this point in the history
It only prints the command line args and source file for now.
  • Loading branch information
knocte committed Aug 26, 2023
1 parent 3063032 commit 7c32dca
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fsxc/Fsxc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Flag =
| Force
| OnlyCheck
| Verbose
| Debug

type ProvidedCommandLineArguments =
{
Expand Down Expand Up @@ -86,6 +87,8 @@ module Program =
Console.WriteLine()
Console.WriteLine "Options"

Console.WriteLine " -d, --debug Show debugging information"

Console.WriteLine
" -f, --force Always generate binaries again even if existing binaries are new enough"

Expand All @@ -111,6 +114,8 @@ module Program =
Some OnlyCheck
elif arg = "-v" || arg = "--verbose" then
Some Verbose
elif arg = "-d" || arg = "--debug" then
Some Debug
elif arg.StartsWith "-" then
failwithf "Flag not recognized: %s" arg
else
Expand Down Expand Up @@ -944,6 +949,21 @@ let fsi = { CommandLineArgs = System.Environment.GetCommandLineArgs() }

let verbose = parsedArgs.Flags.Contains Flag.Verbose

let debug = parsedArgs.Flags.Contains Flag.Debug

if debug then
let cmdLineArgs = Environment.GetCommandLineArgs()

Console.WriteLine(
sprintf "DEBUG: __SOURCE_FILE__: %s" __SOURCE_FILE__
)

Console.WriteLine(
sprintf
"DEBUG: Env.CmdLineArgs: %s"
(String.Join(",", cmdLineArgs))
)

let scriptContents, lastWriteTimeOfSourceFiles =
GetParsedContentsAndOldestLastWriteTimeFromScriptOrItsDependencies
parsedArgs.Script
Expand Down

0 comments on commit 7c32dca

Please sign in to comment.