-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cs
595 lines (495 loc) · 14.5 KB
/
main.cs
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
// This file was automatically generated at 12/19/2024 4:48:58 PM
//
// Changes to this file may be overwritten without warning
//
// Generator: commandparse version 3.0.0.879
// Goedel Script Version : 0.1 Generated
// Goedel Schema Version : 0.1 Generated
//
// Copyright : © 2015-2021
//
// Build Platform: Win32NT 10.0.22631.0
//
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Goedel.Command;
using Goedel.Utilities;
#pragma warning disable IDE0079
#pragma warning disable IDE1006
#pragma warning disable CS1591
namespace MakeRFC;
public partial class CommandLineInterpreter : CommandLineInterpreterBase {
/// <summary>The command entries</summary>
public static SortedDictionary<string, DescribeCommand> Entries { get; set; }
/// <summary>The default command.</summary>
public static DescribeCommandEntry DefaultCommand { get; set; }
/// <summary>Description of the comman</summary>
public static string Description { get; set; } = "<Not specified>";
static readonly char UnixFlag = '-';
static readonly char WindowsFlag = '/';
/// <summary>
/// Describe the application invoked by the command.
/// </summary>
/// <param name="Dispatch">The command description.</param>
/// <param name="args">The set of arguments.</param>
/// <param name="index">The first unparsed argument.</param>
public static void About (DispatchShell Dispatch, string[] args, int index) =>
FileTools.About();
public readonly static DescribeCommandEntry DescribeAbout = new () {
Identifier = "about",
HandleDelegate = About,
Entries = new () { }
};
static CommandLineInterpreter () {
System.OperatingSystem OperatingSystem = System.Environment.OSVersion;
if (OperatingSystem.Platform == PlatformID.Unix |
OperatingSystem.Platform == PlatformID.MacOSX) {
FlagIndicator = UnixFlag;
}
else {
FlagIndicator = WindowsFlag;
}
DefaultCommand = _RFC._DescribeCommand;
Description = "brief";
Entries = new () {
{"rfc", _RFC._DescribeCommand },
{"new", _Template._DescribeCommand },
{"about", DescribeAbout }
}; // End Entries
}
static void Main(string[] args) {
var CLI = new CommandLineInterpreter ();
CLI.MainMethod (args);
}
public void MainMethod(string[] Args) {
Shell Dispatch = new ();
try {
MainMethod (Dispatch, Args);
}
catch (Goedel.Command.ParserException) {
Brief(Description, DefaultCommand, Entries);
}
catch (System.Exception Exception) {
Console.WriteLine("Application: {0}", Exception.Message);
}
}
public void MainMethod(Shell Dispatch, string[] Args) =>
Dispatcher (Entries, DefaultCommand, Dispatch, Args, 0);
public static void Handle_RFC (
DispatchShell DispatchIn, string[] Args, int Index) {
Shell Dispatch = DispatchIn as Shell;
RFC Options = new ();
ProcessOptions (Args, Index, Options);
Dispatch._PreProcess (Options);
Dispatch.RFC (Options);
}
public static void Handle_Template (
DispatchShell DispatchIn, string[] Args, int Index) {
Shell Dispatch = DispatchIn as Shell;
Template Options = new ();
ProcessOptions (Args, Index, Options);
Dispatch._PreProcess (Options);
Dispatch.Template (Options);
}
} // class Main
// The stub class for carrying optional parameters for each command type
// As with the main class each consists of an abstract main class
// with partial virtual that can be extended as required.
// All subclasses inherit from the abstract classes Goedel.Regisrty.Dispatch
// and Goedel.Command.Type
public class _RFC : Goedel.Command.Dispatch {
public override Goedel.Command.Type[] _Data {get; set;} = new Goedel.Command.Type[] {
new Flag (),
new ExistingFile (),
new String (),
new String (),
new NewFile (),
new NewFile (),
new NewFile (),
new NewFile (),
new NewFile (),
new NewFile (),
new NewFile (),
new ExistingFile (),
new ExistingFile (),
new ExistingFile (),
new ExistingFile (),
new Flag () } ;
/// <summary>Field accessor for parameter [lazy]</summary>
public virtual Flag Lazy {
get => _Data[0] as Flag;
set => _Data[0] = value;
}
public virtual string _Lazy {
set => _Data[0].Parameter (value);
}
/// <summary>Field accessor for parameter []</summary>
public virtual ExistingFile InputFile {
get => _Data[1] as ExistingFile;
set => _Data[1] = value;
}
public virtual string _InputFile {
set => _Data[1].Parameter (value);
}
/// <summary>Field accessor for option [in]</summary>
public virtual String InputFormat {
get => _Data[2] as String;
set => _Data[2] = value;
}
public virtual string _InputFormat {
set => _Data[2].Parameter (value);
}
/// <summary>Field accessor for option [catalog]</summary>
public virtual String Catalog {
get => _Data[3] as String;
set => _Data[3] = value;
}
public virtual string _Catalog {
set => _Data[3].Parameter (value);
}
/// <summary>Field accessor for option [html]</summary>
public virtual NewFile HTML {
get => _Data[4] as NewFile;
set => _Data[4] = value;
}
public virtual string _HTML {
set => _Data[4].Parameter (value);
}
/// <summary>Field accessor for option [xml]</summary>
public virtual NewFile XML {
get => _Data[5] as NewFile;
set => _Data[5] = value;
}
public virtual string _XML {
set => _Data[5].Parameter (value);
}
/// <summary>Field accessor for option [txt]</summary>
public virtual NewFile TXT {
get => _Data[6] as NewFile;
set => _Data[6] = value;
}
public virtual string _TXT {
set => _Data[6].Parameter (value);
}
/// <summary>Field accessor for option [md]</summary>
public virtual NewFile MD {
get => _Data[7] as NewFile;
set => _Data[7] = value;
}
public virtual string _MD {
set => _Data[7].Parameter (value);
}
/// <summary>Field accessor for option [docx]</summary>
public virtual NewFile DOC {
get => _Data[8] as NewFile;
set => _Data[8] = value;
}
public virtual string _DOC {
set => _Data[8].Parameter (value);
}
/// <summary>Field accessor for option [aml]</summary>
public virtual NewFile AML {
get => _Data[9] as NewFile;
set => _Data[9] = value;
}
public virtual string _AML {
set => _Data[9].Parameter (value);
}
/// <summary>Field accessor for option [w3c]</summary>
public virtual NewFile W3C {
get => _Data[10] as NewFile;
set => _Data[10] = value;
}
public virtual string _W3C {
set => _Data[10].Parameter (value);
}
/// <summary>Field accessor for option [bib]</summary>
public virtual ExistingFile Bibliography {
get => _Data[11] as ExistingFile;
set => _Data[11] = value;
}
public virtual string _Bibliography {
set => _Data[11].Parameter (value);
}
/// <summary>Field accessor for option [cache]</summary>
public virtual ExistingFile Cache {
get => _Data[12] as ExistingFile;
set => _Data[12] = value;
}
public virtual string _Cache {
set => _Data[12].Parameter (value);
}
/// <summary>Field accessor for option [style]</summary>
public virtual ExistingFile Stylesheet {
get => _Data[13] as ExistingFile;
set => _Data[13] = value;
}
public virtual string _Stylesheet {
set => _Data[13].Parameter (value);
}
/// <summary>Field accessor for option [boiler]</summary>
public virtual ExistingFile Boilerplate {
get => _Data[14] as ExistingFile;
set => _Data[14] = value;
}
public virtual string _Boilerplate {
set => _Data[14].Parameter (value);
}
/// <summary>Field accessor for option [auto]</summary>
public virtual Flag Auto {
get => _Data[15] as Flag;
set => _Data[15] = value;
}
public virtual string _Auto {
set => _Data[15].Parameter (value);
}
public override DescribeCommandEntry DescribeCommand {get; set;} = _DescribeCommand;
public readonly static DescribeCommandEntry _DescribeCommand = new () {
Identifier = "rfc",
Brief = "<Unspecified>",
HandleDelegate = CommandLineInterpreter.Handle_RFC,
Lazy = true,
IsDefault = true,
Entries = new List<DescribeEntry> () {
new DescribeEntryParameter () {
Identifier = "InputFile",
Default = null, // null if null
Brief = "<Unspecified>",
Index = 1,
Key = ""
},
new DescribeEntryOption () {
Identifier = "InputFormat",
Default = null, // null if null
Brief = "<Unspecified>",
Index = 2,
Key = "in"
},
new DescribeEntryOption () {
Identifier = "Catalog",
Default = null, // null if null
Brief = "<Unspecified>",
Index = 3,
Key = "catalog"
},
new DescribeEntryOption () {
Identifier = "HTML",
Default = "html", // null if null
Brief = "<Unspecified>",
Index = 4,
Key = "html"
},
new DescribeEntryOption () {
Identifier = "XML",
Default = "xml", // null if null
Brief = "<Unspecified>",
Index = 5,
Key = "xml"
},
new DescribeEntryOption () {
Identifier = "TXT",
Default = "txt", // null if null
Brief = "<Unspecified>",
Index = 6,
Key = "txt"
},
new DescribeEntryOption () {
Identifier = "MD",
Default = "md", // null if null
Brief = "<Unspecified>",
Index = 7,
Key = "md"
},
new DescribeEntryOption () {
Identifier = "DOC",
Default = "docx", // null if null
Brief = "<Unspecified>",
Index = 8,
Key = "docx"
},
new DescribeEntryOption () {
Identifier = "AML",
Default = "aml", // null if null
Brief = "<Unspecified>",
Index = 9,
Key = "aml"
},
new DescribeEntryOption () {
Identifier = "W3C",
Default = "html", // null if null
Brief = "<Unspecified>",
Index = 10,
Key = "w3c"
},
new DescribeEntryOption () {
Identifier = "Bibliography",
Default = null, // null if null
Brief = "<Unspecified>",
Index = 11,
Key = "bib"
},
new DescribeEntryOption () {
Identifier = "Cache",
Default = null, // null if null
Brief = "<Unspecified>",
Index = 12,
Key = "cache"
},
new DescribeEntryOption () {
Identifier = "Stylesheet",
Default = null, // null if null
Brief = "<Unspecified>",
Index = 13,
Key = "style"
},
new DescribeEntryOption () {
Identifier = "Boilerplate",
Default = null, // null if null
Brief = "<Unspecified>",
Index = 14,
Key = "boiler"
},
new DescribeEntryOption () {
Identifier = "Auto",
Default = "false", // null if null
Brief = "<Unspecified>",
Index = 15,
Key = "auto"
}
}
};
}
public partial class RFC : _RFC {
} // class RFC
public class _Template : Goedel.Command.Dispatch {
public override Goedel.Command.Type[] _Data {get; set;} = new Goedel.Command.Type[] {
new String (),
new NewFile (),
new NewFile (),
new NewFile (),
new NewFile () } ;
/// <summary>Field accessor for parameter []</summary>
public virtual String Identifier {
get => _Data[0] as String;
set => _Data[0] = value;
}
public virtual string _Identifier {
set => _Data[0].Parameter (value);
}
/// <summary>Field accessor for option [html]</summary>
public virtual NewFile HTML {
get => _Data[1] as NewFile;
set => _Data[1] = value;
}
public virtual string _HTML {
set => _Data[1].Parameter (value);
}
/// <summary>Field accessor for option [xml]</summary>
public virtual NewFile XML {
get => _Data[2] as NewFile;
set => _Data[2] = value;
}
public virtual string _XML {
set => _Data[2].Parameter (value);
}
/// <summary>Field accessor for option [md]</summary>
public virtual NewFile MD {
get => _Data[3] as NewFile;
set => _Data[3] = value;
}
public virtual string _MD {
set => _Data[3].Parameter (value);
}
/// <summary>Field accessor for option [docx]</summary>
public virtual NewFile DOC {
get => _Data[4] as NewFile;
set => _Data[4] = value;
}
public virtual string _DOC {
set => _Data[4].Parameter (value);
}
public override DescribeCommandEntry DescribeCommand {get; set;} = _DescribeCommand;
public readonly static DescribeCommandEntry _DescribeCommand = new () {
Identifier = "new",
Brief = "<Unspecified>",
HandleDelegate = CommandLineInterpreter.Handle_Template,
Lazy = false,
Entries = new List<DescribeEntry> () {
new DescribeEntryParameter () {
Identifier = "Identifier",
Default = null, // null if null
Brief = "<Unspecified>",
Index = 0,
Key = ""
},
new DescribeEntryOption () {
Identifier = "HTML",
Default = "html", // null if null
Brief = "<Unspecified>",
Index = 1,
Key = "html"
},
new DescribeEntryOption () {
Identifier = "XML",
Default = "xml", // null if null
Brief = "<Unspecified>",
Index = 2,
Key = "xml"
},
new DescribeEntryOption () {
Identifier = "MD",
Default = "md", // null if null
Brief = "<Unspecified>",
Index = 3,
Key = "md"
},
new DescribeEntryOption () {
Identifier = "DOC",
Default = "docx", // null if null
Brief = "<Unspecified>",
Index = 4,
Key = "docx"
}
}
};
}
public partial class Template : _Template {
} // class Template
public partial class Flag : Goedel.Command._Flag {
public Flag(string value=null) : base (value) {}
} // Flag
public partial class File : Goedel.Command._File {
public File(string value=null) : base (value) {}
} // File
public partial class NewFile : Goedel.Command._NewFile {
public NewFile(string value=null) : base (value) {}
} // NewFile
public partial class ExistingFile : Goedel.Command._ExistingFile {
public ExistingFile(string value=null) : base (value) {}
} // ExistingFile
public partial class Integer : Goedel.Command._Integer {
public Integer(string value=null) : base (value) {}
} // Integer
public partial class String : Goedel.Command._String {
public String(string value=null) : base (value) {}
} // String
public partial class Enumeration<T> : _Enumeration<T> {
public Enumeration(DescribeEntryEnumerate description) : base(description){
}
} // _Enumeration<T>
// The stub class just contains routines that echo their arguments and
// write 'not yet implemented'
// Eventually there will be a compiler option to suppress the debugging
// to eliminate the redundant code
public class _Shell : global::Goedel.Command.DispatchShell {
public virtual void RFC ( RFC Options) =>
CommandLineInterpreter.DescribeValues (Options);
public virtual void Template ( Template Options) =>
CommandLineInterpreter.DescribeValues (Options);
} // class _Shell
public partial class Shell : _Shell {
} // class Shell