Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added basic support for command line options (port and help).

  • Loading branch information...
commit f32944c46a74f20f30b2436d5b0f7513ef2d70a3 1 parent 5b8072f
@richardlawrence richardlawrence authored
View
33 Cuke4Nuke/Server/Program.cs
@@ -1,4 +1,5 @@
using System;
+using NDesk.Options;
namespace Cuke4Nuke.Server
{
@@ -7,7 +8,39 @@ class Program
static void Main(string[] args)
{
int port = 3901;
+ bool showHelp = false;
+
+ var p = new OptionSet()
+ {
+ {
+ "p|port=",
+ "the {PORT} the server should listen on.",
+ (int v) => port = v
+ },
+ {
+ "h|?|help",
+ "show this message and exit.",
+ v => showHelp = v != null
+ }
+ };
+ p.Parse(args);
+
+ if (showHelp)
+ {
+ ShowHelp(p);
+ return;
+ }
+
Listener listener = new Listener(port);
}
+
+ static void ShowHelp(OptionSet p)
+ {
+ Console.WriteLine("Usage: Cuke4Nuke.Server.exe [OPTIONS]");
+ Console.WriteLine("Start the Cuke4Nuke server to invoke .NET Cucumber step definitions.");
+ Console.WriteLine();
+ Console.WriteLine("Options:");
+ p.WriteOptionDescriptions(Console.Out);
+ }
}
}
View
4 Cuke4Nuke/Test/Server_Specification.cs
@@ -13,7 +13,7 @@ namespace Test
public class Server_Specification
{
Process serverProcess;
- int port = 3901;
+ int port = 3902;
TcpClient client;
[TestFixtureSetUp]
@@ -21,7 +21,7 @@ public void TestFixtureSetup()
{
// launch the Cuke4Nuke server in a separate process
string serverExePath = @"..\..\..\Server\bin\Debug\Cuke4Nuke.Server.exe";
- serverProcess = Process.Start(serverExePath);
+ serverProcess = Process.Start(serverExePath, "-p " + port);
// connect to the Cuke4Nuker server over TCP
client = new TcpClient("localhost", port);
Please sign in to comment.
Something went wrong with that request. Please try again.