Permalink
Browse files

adding an explicit 'version' command

  • Loading branch information...
1 parent 44675e2 commit b33895c5684086165be12e501b5a00818113c5a3 @davidalpert davidalpert committed Aug 26, 2012
Showing with 41 additions and 0 deletions.
  1. +40 −0 GitTfs/Commands/Version.cs
  2. +1 −0 GitTfs/GitTfs.csproj
View
@@ -0,0 +1,40 @@
+using System;
+using System.ComponentModel;
+using System.IO;
+using NDesk.Options;
+using StructureMap;
+using Sep.Git.Tfs.Core;
+
+namespace Sep.Git.Tfs.Commands
+{
+ [Pluggable("version")]
+ [Description("version")]
+ public class Version : GitTfsCommand
+ {
+ private Globals globals;
+ TextWriter stdout;
+ IGitTfsVersionProvider versionProvider;
+
+ /// <summary>
+ /// Initializes a new instance of the Version class.
+ /// </summary>
+ /// <param name="stdout"></param>
+ /// <param name="versionProvider"></param>
+ public Version(Globals globals, TextWriter stdout, IGitTfsVersionProvider versionProvider)
+ {
+ this.globals = globals;
+ this.stdout = stdout;
+ this.versionProvider = versionProvider;
+
+ this.OptionSet = globals.OptionSet;
+ }
+
+ public int Run()
+ {
+ stdout.WriteLine(versionProvider.GetVersionString());
+ return GitTfsExitCodes.OK;
+ }
+
+ public OptionSet OptionSet { get; private set; }
+ }
+}
View
@@ -128,6 +128,7 @@
<Compile Include="Commands\Shelve.cs" />
<Compile Include="Commands\Verify.cs" />
<Compile Include="Commands\Unshelve.cs" />
+ <Compile Include="Commands\Version.cs" />
<Compile Include="Core\Changes\Git\Add.cs" />
<Compile Include="Core\Changes\Git\Delete.cs" />
<Compile Include="Core\Changes\Git\Modify.cs" />

0 comments on commit b33895c

Please sign in to comment.