anchor.diff:      printfn "  add-argument <position> <argument_name> <default_value> [<filename>]"
       printfn ""
       printfn "Options:"
  -    printfn "  -h, --help                           Display this message and exit"
  -    printfn "  -i [SUFFIX], --in-place=[SUFFIX]     Modify the input file in-place (makes backup if extension supplied)"
  -    printfn "  -o FILENAME, --output-file=FILENAME  Write result to FILENAME"
  +    printfn "  -h, --help                          Display this message and exit"
  +    printfn "  -i[SUFFIX], --in-place=[SUFFIX]     Modify the input file in-place (makes backup if extension supplied)"
  +    printfn "  -oFILENAME, --output-file=FILENAME  Write result to FILENAME"
       
   
   exception ArgumentException of string
  
positive.code:         | 4 -> (parsePos args.[0], args.[1], args.[2], Some args.[3])
          | _ -> raise (ArgumentException "Too many arguments")
  
  let refactorWithArguments args =
      match args with
          | "rename"::rest ->
              let position, newName, filename =
                  parseRenameArguments rest
              Rename filename position newName
          | "extract-function"::rest ->
              let expressionRange, functionName, filename =
                  parseExtractFunctionArguments rest
              ExtractFunction filename expressionRange functionName
          | "add-argument"::rest ->
              let position, argumentName, defaultValue, filename =
                  parseAddArgumentArguments rest
              AddArgument filename position argumentName defaultValue
          | name::_ -> raise (ArgumentException (sprintf "%s is not a valid refactoring name" name))
          | [] -> raise (ArgumentException "Too few arguments")
  
  type Options() =
      member this.Help = ref false
      member this.InPlace = ref false
      member this.OutputFile = ref None
  //TODO: Handle KeyNotFoundException sensible
  [<EntryPoint>]
  let main(args : string[]) =
      let options = new Options()
      let optionSet = new OptionSet()
      //TODO: get the argument passed in with -i or -o
      optionSet.Add("h|help", fun _ -> options.Help := true) |> ignore
      optionSet.Add("i|in-place", fun s -> options.InPlace := true) |> ignore
      optionSet.Add("o|output-file", fun f -> options.OutputFile := Some f) |> ignore
      let extra = Seq.toList (optionSet.Parse(args))
  
      if !options.Help then
          printUsage ()
          0
      else
  
negative.code:         if Option.isNone resultCode then
              1
          else
              if options.InPlace then
                  let filename = getFilename extra
                  if Option.isSome options.InPlaceSuffix then
                      File.WriteAllText(filename + "." + (options.InPlaceSuffix).Value,
                                        File.ReadAllText(filename))
                  File.WriteAllText(filename, resultCode.Value)
  
              if Option.isSome options.OutputFile then
                  File.WriteAllText((options.OutputFile).Value, resultCode.Value)
  
              printfn "%s" resultCode.Value
              0
  