Created
September 10, 2011 06:24
-
-
Save killerswan/1208007 to your computer and use it in GitHub Desktop.
args for both interactive and compiled F#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright © 2011, Kevin Cantu, [email protected] | |
// | |
// Usage: runfsi --nologo --exec args2.fs -- $@ | |
module Simple | |
open System | |
open System.IO | |
let inline (^<|) f a = f a | |
let args = | |
#if COMPILED | |
System.Environment.GetCommandLineArgs() | |
#endif | |
#if INTERACTIVE | |
fsi.CommandLineArgs | |
#endif | |
let (me, var1, var2) = | |
match args with | |
| [| x; y; z |] -> | |
(x,y,z) | |
| _ -> | |
printfn "%d args given..." (args.Length - 1) | |
printfn "Usage: %s REF TEST" args.[0] | |
exit 1 | |
printfn "%s" var1 | |
printfn "%s" var2 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment