mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 03:01:24 +00:00
Added new console for all examples later on
This commit is contained in:
41
MewTerminal/Commands/CommandLineExcecuteable.cs
Normal file
41
MewTerminal/Commands/CommandLineExcecuteable.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using CommandLine.Text;
|
||||
using CommandLine;
|
||||
using MewtocolNet.Logging;
|
||||
|
||||
namespace MewTerminal.Commands;
|
||||
|
||||
public abstract class CommandLineExcecuteable {
|
||||
|
||||
static UnParserSettings UnparserSet = new UnParserSettings {
|
||||
PreferShortName = true,
|
||||
};
|
||||
|
||||
[Option('v', "verbosity", HelpText = "Sets the Loglevel verbosity", Default = LogLevel.None)]
|
||||
public LogLevel LogLevel { get; set; } = LogLevel.None;
|
||||
|
||||
[Usage]
|
||||
public static IEnumerable<Example> Examples {
|
||||
get {
|
||||
return new List<Example>() {
|
||||
new Example(
|
||||
helpText: "Sanning from adapter with ip 127.0.0.1 and logging all critical messages",
|
||||
formatStyle: UnparserSet,
|
||||
sample: new ScanCommand {
|
||||
IPSource = "127.0.0.1",
|
||||
LogLevel = LogLevel.Critical,
|
||||
}),
|
||||
new Example(
|
||||
helpText: "Scanning from all adapters and logging only errors",
|
||||
formatStyle: UnparserSet,
|
||||
sample: new ScanCommand {
|
||||
LogLevel = LogLevel.Error,
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Run() { }
|
||||
|
||||
public virtual Task RunAsync () => Task.CompletedTask;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user