File: Options.fs

package info (click to toggle)
monodevelop 5.10.0.871-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 272,040 kB
  • ctags: 258,152
  • sloc: cs: 1,439,098; xml: 947,206; ansic: 148,611; java: 64,114; makefile: 4,256; lisp: 3,174; python: 2,072; sh: 2,058; objc: 302; sql: 111; php: 65
file content (42 lines) | stat: -rw-r--r-- 1,364 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// --------------------------------------------------------------------------------------
// (c) Robin Neatherway
// --------------------------------------------------------------------------------------
namespace FSharp.InteractiveAutocomplete

open System

module Version =
  let string = "FSharp.AutoComplete 0.13.3"

module Options =

  let verbose = ref false
  let timeout = ref 10

  let verboseFilter : Ref<Option<Set<string>>> = ref None

  let p = new NDesk.Options.OptionSet()
  Seq.iter (fun (s:string,d:string,a:string -> unit) -> ignore (p.Add(s,d,a)))
    [
      "version", "display versioning information",
        fun _ -> printfn "%s" Version.string;
                 exit 0

      "v|verbose", "enable verbose mode",
        fun _ -> Debug.verbose := true

      "l|logfile=", "send verbose output to specified log file",
        fun s -> try
                   Debug.output := (IO.File.CreateText(s) :> IO.TextWriter)
                 with
                   | e -> printfn "Bad log file: %s" e.Message
                          exit 1

      "vfilter=", "apply a comma-separated {FILTER} to verbose output",
        fun v -> Debug.categories := v.Split(',') |> set |> Some

      "h|?|help", "display this help!",
        fun _ -> printfn "%s" Version.string;
                 p.WriteOptionDescriptions(stdout);
                 exit 0
    ]