Skip to content

Commit

Permalink
Add version output, use semantic versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
BobVul committed Nov 17, 2014
1 parent c4d8fe6 commit 856d0ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 12 additions & 1 deletion IdleShutdown/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Mono.Options;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;

Expand All @@ -26,6 +28,7 @@ static void Main(string[] args)

double initialDelay = 5;
bool persistent = false;
bool showVersion = false;
bool showHelp = false;
OptionSet options = new OptionSet()
{
Expand All @@ -37,11 +40,19 @@ static void Main(string[] args)
{ "p|persistent",
"Start an instance that sits in the background waiting for notification from another instance.\n" +
"See issue #1 on GitHub for details.", (p) => persistent = p != null },
{ "?|h|help", "Show this help.", (h) => showHelp = h != null }
{ "version", "Display the version and exit.", (v) => showVersion = v != null },
{ "?|h|help", "Display this help and exit.", (h) => showHelp = h != null }
};

options.Parse(args);

if (showVersion)
{
AssemblyInformationalVersionAttribute version = (AssemblyInformationalVersionAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false)[0];
MessageBox.Show(version.InformationalVersion);
return;
}

if (showHelp)
{
// why does Mono.Options apparently not include a way to get descriptions as a string?
Expand Down
5 changes: 3 additions & 2 deletions IdleShutdown/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0-alpha")]

0 comments on commit 856d0ee

Please sign in to comment.