Files
git-tfs/GitTfs/Commands/Cleanup.cs
T
2012-02-01 07:27:49 -05:00

39 lines
890 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using NDesk.Options;
using Sep.Git.Tfs.Core;
using Sep.Git.Tfs.Core.TfsInterop;
using StructureMap;
namespace Sep.Git.Tfs.Commands
{
[Pluggable("cleanup")]
[RequiresValidGitRepository]
public class Cleanup : GitTfsCommand
{
private readonly CleanupWorkspaces _cleanupWorkspaces;
public Cleanup(CleanupWorkspaces cleanupWorkspaces)
{
_cleanupWorkspaces = cleanupWorkspaces;
}
public OptionSet OptionSet
{
get { return _cleanupWorkspaces.OptionSet; }
}
public int Run()
{
return Choose(_cleanupWorkspaces.Run());
}
private int Choose(params int[] results)
{
return results.Where(x => x != GitTfsExitCodes.OK).FirstOr(GitTfsExitCodes.OK);
}
}
}