1 (* ========================================================================= *) |
1 (* ========================================================================= *) |
2 (* PROCESSING COMMAND LINE OPTIONS *) |
2 (* PROCESSING COMMAND LINE OPTIONS *) |
3 (* Copyright (c) 2003-2004 Joe Hurd, distributed under the BSD License *) |
3 (* Copyright (c) 2003-2004 Joe Hurd, distributed under the BSD License *) |
4 (* ========================================================================= *) |
4 (* ========================================================================= *) |
5 |
5 |
6 structure Options :> Options = |
6 structure Options :> Options = |
7 struct |
7 struct |
8 |
8 |
114 val basicOptions : opt list = |
114 val basicOptions : opt list = |
115 [{switches = ["--"], arguments = [], |
115 [{switches = ["--"], arguments = [], |
116 description = "no more options", |
116 description = "no more options", |
117 processor = fn _ => raise Fail "basicOptions: --"}, |
117 processor = fn _ => raise Fail "basicOptions: --"}, |
118 {switches = ["-?","-h","--help"], arguments = [], |
118 {switches = ["-?","-h","--help"], arguments = [], |
119 description = "display all options and exit", |
119 description = "display option information and exit", |
120 processor = fn _ => raise OptionExit |
120 processor = fn _ => raise OptionExit |
121 {message = SOME "displaying all options", usage = true, success = true}}, |
121 {message = SOME "displaying option information", |
|
122 usage = true, success = true}}, |
122 {switches = ["-v", "--version"], arguments = [], |
123 {switches = ["-v", "--version"], arguments = [], |
123 description = "display version information", |
124 description = "display version information", |
124 processor = fn _ => raise Fail "basicOptions: -v, --version"}]; |
125 processor = fn _ => raise Fail "basicOptions: -v, --version"}]; |
125 |
126 |
126 (* ------------------------------------------------------------------------- *) |
127 (* ------------------------------------------------------------------------- *) |
127 (* All the command line options of a program *) |
128 (* All the command line options of a program *) |
128 (* ------------------------------------------------------------------------- *) |
129 (* ------------------------------------------------------------------------- *) |
129 |
130 |
130 type allOptions = {name : string, version : string, header : string, |
131 type allOptions = |
131 footer : string, options : opt list}; |
132 {name : string, version : string, header : string, |
|
133 footer : string, options : opt list}; |
132 |
134 |
133 (* ------------------------------------------------------------------------- *) |
135 (* ------------------------------------------------------------------------- *) |
134 (* Usage information *) |
136 (* Usage information *) |
135 (* ------------------------------------------------------------------------- *) |
137 (* ------------------------------------------------------------------------- *) |
136 |
138 |