]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/bin/roles/roles.ml
update in binaries for λδ
[helm.git] / matita / matita / contribs / lambdadelta / bin / roles / roles.ml
1 (*
2     ||M||  This file is part of HELM, an Hypertextual, Electronic
3     ||A||  Library of Mathematics, developed at the Computer Science
4     ||T||  Department, University of Bologna, Italy.
5     ||I||
6     ||T||  HELM is free software; you can redistribute it and/or
7     ||A||  modify it under the terms of the GNU General Public License
8     \   /  version 2 or (at your option) any later version.
9      \ /   This software is distributed as is, NO WARRANTY.
10       V_______________________________________________________________ *)
11
12 module EE = RolesEngine
13 module EG = RolesGlobal
14 module ET = RolesTypes
15 module EU = RolesUtils
16 module WE = WebEngine
17
18 let help_B = "<url>  Set this base url (default: http://helm.cs.unibo.it/lambdadelta/)"
19 let help_C = "<dir>  Set this relative working directory (default: invocation directory)"
20 let help_L = " Debug osn lexer"
21 let help_W = " Run as an LWS application"
22 let help_X = " Reset all options to defaults"
23 let help_a = " Add selected names to a role"
24 let help_d = " Remove selected names from roles"
25 let help_m = " Add roles relating matching names"
26 let help_n = "<version>  Start a stage with this version"
27 let help_p = " Print current status on standard output"
28 let help_r = " Load current status"
29 let help_s = "<pointer>  Toggle the selection of this pointed entry"
30 let help_t = "<version>  Add top objects for this stage"
31 let help_w = " Save current status"
32 let help_x = "<pointer>  Toggle the expansion of this pointed entry"
33 let help   = "Usage: roles [ -LWXadmprw | -B <url> | -C <dir> | -nt <version> | -sx <pointer> | <file> ]*"
34
35 let change_cwd s =
36   EG.cwd := Filename.concat !EG.cwd s
37
38 let add_tops s =
39   EE.add_tops (EU.version_of_string s)
40
41 let new_stage s =
42   EE.new_stage (EU.version_of_string s)
43
44 let select_entry s =
45   EE.select_entry (EU.pointer_of_string s)
46
47 let expand_entry s =
48   EE.expand_entry (EU.pointer_of_string s)
49
50 let process s =
51   match Filename.extension s with
52   | ".txt" -> EE.read_waiting s
53   | x      -> EU.raise_error (ET.EWrongExt x)
54
55 let _main = try
56   Arg.parse [
57     "-B", Arg.String ((:=) EG.base_url), help_B;
58     "-C", Arg.String change_cwd, help_C;
59     "-L", Arg.Set EG.debug_lexer, help_L;
60     "-W", Arg.Unit WE.init, help_W;
61     "-X", Arg.Unit EG.clear, help_X;
62     "-a", Arg.Unit EE.add_role, help_a;
63     "-d", Arg.Unit EE.remove_roles, help_d;
64     "-m", Arg.Unit EE.add_matching, help_m;
65     "-n", Arg.String new_stage, help_n;
66     "-p", Arg.Unit EE.print_status, help_p;
67     "-r", Arg.Unit EE.read_status, help_r;
68     "-s", Arg.String select_entry, help_s;
69     "-t", Arg.String add_tops, help_t;
70     "-w", Arg.Unit EE.write_status, help_w;
71     "-x", Arg.String expand_entry, help_x;
72   ] process help
73 with ET.Error e -> Printf.eprintf "roles: %s\n%!" (EU.string_of_error e)