Skip to content

Commit 598f209

Browse files
committed
fsxc: add --debug flag
It only prints the command line args for now.
1 parent 3063032 commit 598f209

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

fsxc/Fsxc.fs

Lines changed: 22 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,23 @@ 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
959+
"DEBUG: __SOURCE_FILE__: %s"
960+
__SOURCE_FILE__
961+
)
962+
963+
Console.WriteLine(
964+
sprintf
965+
"DEBUG: Env.CmdLineArgs: %s"
966+
(String.Join(",", cmdLineArgs))
967+
)
968+
947969
let scriptContents, lastWriteTimeOfSourceFiles =
948970
GetParsedContentsAndOldestLastWriteTimeFromScriptOrItsDependencies
949971
parsedArgs.Script

0 commit comments

Comments
 (0)