Skip to content

Commit 7c32dca

Browse files
committed
fsxc: add --debug flag
It only prints the command line args and source file for now.
1 parent 3063032 commit 7c32dca

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

fsxc/Fsxc.fs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type Flag =
1111
| Force
1212
| OnlyCheck
1313
| Verbose
14+
| Debug
1415

1516
type ProvidedCommandLineArguments =
1617
{
@@ -86,6 +87,8 @@ module Program =
8687
Console.WriteLine()
8788
Console.WriteLine "Options"
8889

90+
Console.WriteLine " -d, --debug Show debugging information"
91+
8992
Console.WriteLine
9093
" -f, --force Always generate binaries again even if existing binaries are new enough"
9194

@@ -111,6 +114,8 @@ module Program =
111114
Some OnlyCheck
112115
elif arg = "-v" || arg = "--verbose" then
113116
Some Verbose
117+
elif arg = "-d" || arg = "--debug" then
118+
Some Debug
114119
elif arg.StartsWith "-" then
115120
failwithf "Flag not recognized: %s" arg
116121
else
@@ -944,6 +949,21 @@ let fsi = { CommandLineArgs = System.Environment.GetCommandLineArgs() }
944949

945950
let verbose = parsedArgs.Flags.Contains Flag.Verbose
946951

952+
let debug = parsedArgs.Flags.Contains Flag.Debug
953+
954+
if debug then
955+
let cmdLineArgs = Environment.GetCommandLineArgs()
956+
957+
Console.WriteLine(
958+
sprintf "DEBUG: __SOURCE_FILE__: %s" __SOURCE_FILE__
959+
)
960+
961+
Console.WriteLine(
962+
sprintf
963+
"DEBUG: Env.CmdLineArgs: %s"
964+
(String.Join(",", cmdLineArgs))
965+
)
966+
947967
let scriptContents, lastWriteTimeOfSourceFiles =
948968
GetParsedContentsAndOldestLastWriteTimeFromScriptOrItsDependencies
949969
parsedArgs.Script

0 commit comments

Comments
 (0)