Skip to content

Commit 7d686d8

Browse files
committed
added initial program bits
1 parent 3f88269 commit 7d686d8

File tree

5 files changed

+68
-30
lines changed

5 files changed

+68
-30
lines changed

Incrementalist.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{79D71264
1717
build.sh = build.sh
1818
EndProjectSection
1919
EndProject
20-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Incrementalist.Console", "src\Incrementalist.Console\Incrementalist.Console.csproj", "{3676CB0B-131A-4E92-9CB8-9817547D2CE6}"
20+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Incrementalist.Cmd", "src\Incrementalist.Cmd\Incrementalist.Cmd.csproj", "{48A85CA0-FA3A-4F7A-A651-B091C5F3A9CB}"
2121
EndProject
2222
Global
2323
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -37,10 +37,10 @@ Global
3737
{CAE7CA7C-0D0C-4FDA-BDE9-BE16A27343EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
3838
{CAE7CA7C-0D0C-4FDA-BDE9-BE16A27343EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
3939
{CAE7CA7C-0D0C-4FDA-BDE9-BE16A27343EF}.Release|Any CPU.Build.0 = Release|Any CPU
40-
{3676CB0B-131A-4E92-9CB8-9817547D2CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41-
{3676CB0B-131A-4E92-9CB8-9817547D2CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
42-
{3676CB0B-131A-4E92-9CB8-9817547D2CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
43-
{3676CB0B-131A-4E92-9CB8-9817547D2CE6}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{48A85CA0-FA3A-4F7A-A651-B091C5F3A9CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41+
{48A85CA0-FA3A-4F7A-A651-B091C5F3A9CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
42+
{48A85CA0-FA3A-4F7A-A651-B091C5F3A9CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{48A85CA0-FA3A-4F7A-A651-B091C5F3A9CB}.Release|Any CPU.Build.0 = Release|Any CPU
4444
EndGlobalSection
4545
GlobalSection(SolutionProperties) = preSolution
4646
HideSolutionNode = FALSE

src/Incrementalist.Console/Incrementalist.Console.csproj renamed to src/Incrementalist.Cmd/Incrementalist.Cmd.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<Import Project="..\common.props" /> <Import Project="..\common.props" />
2+
<Import Project="..\common.props" />
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp2.1</TargetFramework>

src/Incrementalist.Cmd/Program.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
4+
namespace Incrementalist.Cmd
5+
{
6+
class Program
7+
{
8+
private static string _originalTitle = null;
9+
private static bool IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
10+
11+
private static void SetTitle()
12+
{
13+
if (IsWindows) // changing console title is not supported on OS X or Linux
14+
{
15+
_originalTitle = Console.Title;
16+
Console.Title = StartupData.ConsoleWindowTitle;
17+
}
18+
}
19+
20+
private static void ResetTitle()
21+
{
22+
if (IsWindows)
23+
Console.Title = _originalTitle; // reset the console window title back
24+
}
25+
26+
static int Main(string[] args)
27+
{
28+
SetTitle();
29+
30+
if (args.Length >= 1)
31+
{
32+
if (args[0].ToLowerInvariant().Equals("help"))
33+
{
34+
StartupData.ShowHelp();
35+
ResetTitle();
36+
return 0;
37+
}
38+
}
39+
40+
ResetTitle();
41+
return 0;
42+
}
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Diagnostics;
43
using System.Text;
54

6-
namespace Incrementalist.Console
5+
namespace Incrementalist.Cmd
76
{
87
/// <summary>
98
/// Used for printing startup messages and help.
@@ -19,19 +18,26 @@ public static void ShowSplash()
1918
{
2019
Console.OutputEncoding = Encoding.Unicode;
2120
Console.ForegroundColor = ConsoleColor.Cyan;
22-
Console.WriteLine(
23-
@" ____ _ _ _ _
24-
| _ \ ___| |_ __ _| |__ _ __(_) __| | __ _ ___
25-
| |_) / _ | __/ _` | '_ \| '__| |/ _` |/ _` |/ _ \
26-
| __| __| || (_| | |_) | | | | (_| | (_| | __/
27-
|_| \___|\__\__,_|_.__/|_| |_|\__,_|\__, |\___|
28-
|___/
29-
");
3021
Console.ForegroundColor = ConsoleColor.Green;
31-
Console.WriteLine("petabridge.cmd ({0})", VersionNumber);
22+
Console.WriteLine("Incrementalist ({0})", VersionNumber);
3223
Console.ResetColor();
33-
Console.WriteLine("Copyright 2017 - {0}, Petabridge®.", DateTime.UtcNow.Year);
24+
Console.WriteLine("Copyright 2015 - {0}, Petabridge®.", DateTime.UtcNow.Year);
3425
Console.WriteLine();
3526
}
27+
28+
public static void ShowHelp()
29+
{
30+
Console.WriteLine(
31+
@"Incrementalist " + VersionNumber + @"
32+
33+
Usage: incrementalist targetBranch [solutionFile]
34+
35+
Options:
36+
incrementalist help Show help
37+
38+
Instructions:
39+
40+
");
41+
}
3642
}
3743
}

src/Incrementalist.Console/Program.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)