Skip to content

Commit 59451bf

Browse files
author
Bernt Røskar Brenna
committed
New command line command: dumprefs
1 parent 1dccc35 commit 59451bf

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

netmockery/CommandLineParser.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ static public class CommandLineParser
1212
public const int COMMAND_SERVICE = 2;
1313
public const int COMMAND_TEST = 3;
1414
public const int COMMAND_DUMP = 4;
15+
public const int COMMAND_DUMPREFS = 5;
1516

1617
private const string VALUE_SWITCH_URL = "--url";
1718
private const string VALUE_SWITCH_ONLY = "--only";
@@ -29,7 +30,8 @@ static public class CommandLineParser
2930
{ COMMAND_NORMAL, new[] { VALUE_SWITCH_URL, BOOL_SWITCH_NOTESTMODE } },
3031
{ COMMAND_SERVICE, new[] { VALUE_SWITCH_URL } },
3132
{ COMMAND_TEST, new[] { VALUE_SWITCH_URL, VALUE_SWITCH_ONLY, BOOL_SWITCH_SHOWRESPONSE, BOOL_SWITCH_STOP, BOOL_SWITCH_DIFF, BOOL_SWITCH_LIST} },
32-
{ COMMAND_DUMP, new string[0] }
33+
{ COMMAND_DUMP, new string[0] },
34+
{ COMMAND_DUMPREFS, new string[0] }
3335
};
3436

3537

@@ -105,6 +107,10 @@ static public ParsedCommandLine ParseArguments(string[] args)
105107
command = COMMAND_DUMP;
106108
break;
107109

110+
case "dumprefs":
111+
command = COMMAND_DUMPREFS;
112+
break;
113+
108114
default:
109115
throw new CommandLineParsingException($"Unknown command '{positionalArgs.ElementAt(1)}'");
110116
}

netmockery/Program.cs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static void Main(string[] args)
6363

6464
public static async Task MainAsync(string[] args, CancellationToken token)
6565
{
66-
WriteBanner();
66+
WriteLine($"Netmockery v {NetmockeryVersion} ({FrameworkVersion})");
6767

6868
#if NET462
6969
System.Net.ServicePointManager.ServerCertificateValidationCallback =
@@ -118,6 +118,13 @@ public static async Task MainAsync(string[] args, CancellationToken token)
118118
Dump(endpointCollection);
119119
break;
120120

121+
case CommandLineParser.COMMAND_DUMPREFS:
122+
foreach (var metadataReference in DynamicResponseCreatorBase.GetDefaultMetadataReferences())
123+
{
124+
Console.WriteLine(metadataReference.Display);
125+
}
126+
break;
127+
121128
}
122129
}
123130

@@ -260,17 +267,25 @@ public static void Dump(EndpointCollection endpointCollection)
260267
}
261268
}
262269

263-
public static void WriteBanner()
270+
public static string FrameworkVersion
264271
{
265-
var version = typeof(netmockery.Program).GetTypeInfo().Assembly.GetName().Version;
266-
var versionString = $"{version.Major}.{version.Minor}.{version.MinorRevision}";
272+
get
273+
{
267274
#if NET462
268-
var framework = ".NET Framework";
275+
return "Full .NET Framework";
269276
#else
270-
var framework = ".NET Core";
277+
return ".NET Core";
271278
#endif
279+
}
280+
}
272281

273-
WriteLine($"Netmockery v {versionString} ({framework})");
282+
public static string NetmockeryVersion
283+
{
284+
get
285+
{
286+
var version = typeof(netmockery.Program).GetTypeInfo().Assembly.GetName().Version;
287+
return $"{version.Major}.{version.Minor}.{version.MinorRevision}";
288+
}
274289
}
275290
}
276291
}

0 commit comments

Comments
 (0)