forked from cake-build/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilities.cake
72 lines (59 loc) · 1.49 KB
/
utilities.cake
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
public class ChainedArgument : IProcessArgument
{
private readonly List<IProcessArgument> _arguments;
public ChainedArgument()
{
_arguments = new List<IProcessArgument>();
}
public ChainedArgument Append(IProcessArgument argument)
{
_arguments.Add(argument);
return this;
}
public string Render()
{
return string.Join(",", _arguments.Select(x => x.Render()));
}
public string RenderSafe()
{
return string.Join(",", _arguments.Select(x => x.RenderSafe()));
}
}
public class SingleQuotedArgument : IProcessArgument
{
private readonly IProcessArgument _argument;
public SingleQuotedArgument(string text)
: this(new TextArgument(text))
{
}
public SingleQuotedArgument(IProcessArgument argument)
{
_argument = argument;
}
public string Render()
{
return string.Concat("'", _argument.Render(), "'");
}
public string RenderSafe()
{
return string.Concat("'", _argument.RenderSafe(), "'");
}
}
public class KeyValueArgument : IProcessArgument
{
private readonly string _key;
private readonly IProcessArgument _value;
public KeyValueArgument(string key, IProcessArgument value)
{
_key = key;
_value = value;
}
public string Render()
{
return string.Concat(_key, "=", _value.Render());
}
public string RenderSafe()
{
return string.Concat(_key, "=", _value.RenderSafe());
}
}