Skip to content

Commit

Permalink
Add CLI option test
Browse files Browse the repository at this point in the history
Tests if configured ssh-agent is alive and responding. Useful for
checking programatically.
  • Loading branch information
RaeesBhatti committed Oct 23, 2016
1 parent 2718449 commit 34a7146
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,19 @@ static void Main(string[] args)

if (CommandLine.Parser.Default.ParseArguments(args, options) && args.Length > 0)
{
if (options.Kill)
if (options.Test)
{
bool alive = TestSSHAgent();
if (alive)
{
Console.WriteLine(alive);
}
else
{
Console.Error.WriteLine(alive);
}
}
else if (options.Kill)
{
KillSSHAgent();
}
Expand Down Expand Up @@ -447,6 +459,10 @@ class Options
HelpText = "Disable run at Windows Startup behaviour.")]
public bool UnregisterRestartup { get; set; }

[Option('t', "test", Required = false,
HelpText = "Test if configured ssh-agent is alive and responding. Useful for checking programatically.")]
public bool Test { get; set; }

[Option('k', "kill", Required = false,
HelpText = "Kill the current ssh-agent process and unset environment variables.")]
public bool Kill { get; set; }
Expand Down

0 comments on commit 34a7146

Please sign in to comment.