This repository has been archived by the owner on Aug 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Program.cs
81 lines (68 loc) · 2.02 KB
/
Program.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
#region License
// Copyright Jeremy Skinner (http://www.jeremyskinner.co.uk) and Contributors
//
// Licensed under the Microsoft Public License. You may
// obtain a copy of the license at:
//
// http://www.microsoft.com/opensource/licenses.mspx
//
// By using this source code in any fashion, you are agreeing
// to be bound by the terms of the Microsoft Public License.
//
// You must not remove this notice, or any other, from this software.
#endregion
namespace Phantom {
using System;
using System.Linq;
using Boo.Lang.Useful.CommandLine;
using Core;
internal class Program {
static void Main(string[] args) {
var program = new Program();
program.Execute(args);
}
void Execute(string[] args) {
try {
WriteHeader();
var options = new PhantomOptions();
try {
options.Parse(args);
}
catch (CommandLineException exception) {
Console.WriteLine(exception.Message);
options.PrintHelp(Console.Out);
return;
}
if (options.Help) {
options.PrintHelp(Console.Out);
return;
}
var runner = BuildRunner.Create();
if (options.ShowTargets) {
runner.OutputTargets(options);
return;
}
PrintSelectedTargets(options);
runner.Execute(options);
}
catch (Exception exception) {
Environment.ExitCode = 1;
Console.WriteLine(exception);
}
}
void PrintSelectedTargets(PhantomOptions options) {
string targets = string.Join(", ", options.TargetNames.ToArray());
Console.WriteLine("Targets specified: {0}", targets);
Console.WriteLine();
Console.WriteLine();
}
void WriteHeader() {
string version = typeof (Program).Assembly.GetName().Version.ToString();
Console.WriteLine("Phantom v{0}", version);
Console.WriteLine(string.Format("Copyright (c) 2009-{0} Jeremy Skinner and Contributors", DateTime.Today.Year));
Console.WriteLine("http://github.com/JeremySkinner/Phantom");
Console.WriteLine();
Console.WriteLine();
}
}
}