mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-19 16:47:06 +01:00
Update WireMock.Net.StandAlone
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CommandLineParser.Arguments;
|
||||
using CommandLineParser.Exceptions;
|
||||
using WireMock.Server;
|
||||
@@ -9,11 +11,11 @@ namespace WireMock.Net.StandAlone
|
||||
{
|
||||
private class Options
|
||||
{
|
||||
[ValueArgument(typeof(string), 'u', "Urls", Description = "URL(s) to listen on", Optional = false, AllowMultiple = true)]
|
||||
public string[] Urls;
|
||||
[ValueArgument(typeof(string), 'u', "Urls", Description = "URL(s) to listen on.", Optional = true, AllowMultiple = true)]
|
||||
public List<string> Urls { get; set; }
|
||||
|
||||
[SwitchArgument('p', "AllowPartialMapping", true, Description = "Allow Partial Mapping (default set to true)", Optional = true)]
|
||||
public bool AllowPartialMapping;
|
||||
[SwitchArgument('p', "AllowPartialMapping", true, Description = "Allow Partial Mapping (default set to true).", Optional = true)]
|
||||
public bool AllowPartialMapping { get; set; }
|
||||
}
|
||||
|
||||
static void Main(params string[] args)
|
||||
@@ -21,13 +23,15 @@ namespace WireMock.Net.StandAlone
|
||||
var options = new Options();
|
||||
var parser = new CommandLineParser.CommandLineParser();
|
||||
parser.ExtractArgumentAttributes(options);
|
||||
parser.ParseCommandLine(args);
|
||||
|
||||
try
|
||||
{
|
||||
parser.ParseCommandLine(args);
|
||||
|
||||
var server = FluentMockServer.StartWithAdminInterface(options.Urls);
|
||||
if (!options.Urls.Any())
|
||||
options.Urls.Add("http://localhost:9090/");
|
||||
|
||||
var server = FluentMockServer.StartWithAdminInterface(options.Urls.ToArray());
|
||||
|
||||
if (options.AllowPartialMapping)
|
||||
server.AllowPartialMapping();
|
||||
@@ -39,7 +43,7 @@ namespace WireMock.Net.StandAlone
|
||||
Console.WriteLine(e.Message);
|
||||
parser.ShowUsage();
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine("Press any key to stop the server");
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user