-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParams.cs
66 lines (62 loc) · 1.44 KB
/
Params.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
using System.Collections.Generic;
namespace App {
class Params {
// data
/// <summary>
/// Directly specified input list.
/// </summary>
public string Input;
/// <summary>
/// Input list separator.
/// </summary>
public List<string> InpSep = new List<string>();
/// <summary>
/// Argument list separator.
/// </summary>
public List<string> ArgSep = new List<string>();
/// <summary>
/// Output list separator.
/// </summary>
public List<string> OutSep = new List<string>();
/// <summary>
/// List function called.
/// </summary>
public string Fn;
/// <summary>
/// Input arguments to list function.
/// </summary>
public List<string> Args = new List<string>();
// constructor
/// <summary>
/// Get parameters from input arguments.
/// </summary>
/// <param name="a">Input arguments.</param>
public Params(string[] a) {
for (int i = 0; i < a.Length; i++) {
switch (a[i]) {
case "-i":
case "--input":
if (++i < a.Length) Input = a[i];
break;
case "-s":
case "--input-separator":
if (++i < a.Length) InpSep.Add(a[i]);
break;
case "-t":
case "--argument-separator":
if (++i < a.Length) ArgSep.Add(a[i]);
break;
case "-u":
case "--output-separator":
if (++i < a.Length) OutSep.Add(a[i]);
break;
default:
Fn = a[i++];
for (; i < a.Length; i++)
Args.Add(a[i]);
break;
}
}
}
}
}