fixes, refacts

This commit is contained in:
2018-08-05 04:16:21 +02:00
parent 1f6aaac1fe
commit 0c69d5abbc
19 changed files with 193 additions and 85 deletions

View File

@ -0,0 +1,31 @@
using cli.Model;
using Microsoft.Extensions.CommandLineUtils;
namespace cli.Commands
{
public class AuthCommander : ICommander
{
public CommandLineApplication Integrate(CommandLineApplication rootApp)
{
CommandLineApplication authApp = rootApp.Command("auth",
(target) =>
{
target.FullName = "Authentication methods";
target.Description = "Login, save credentials and get authorized.";
target.HelpOption("-? | -h | --help");
var loginCommand = target.Command("login", app => {
var loginarg = app.Argument("login", "login to use", true);
app.Option( "-s | --save", "Save authentication token to file", CommandOptionType.NoValue);
app.HelpOption("-? | -h | --help");
} );
}, false);
authApp.OnExecute(()=>
{
return 0;
});
return authApp;
}
}
}

View File

@ -1,12 +1,28 @@
using cli.Model;
using Microsoft.Extensions.CommandLineUtils;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using cli.Services;
namespace cli {
public class CiBuildCommand {
namespace cli
{
public class CiBuildCommand : ICommander
{
public CommandLineApplication Integrate(CommandLineApplication rootApp)
{
CommandLineApplication ciBuildApp = rootApp.Command("build",
(target) =>
{
target.FullName = "Build this project.";
target.Description = "Build this project, as specified in .paul-ci.json";
target.HelpOption("-? | -h | --help");
}, false);
ciBuildApp.OnExecute(()=>
{
return 0;
});
return ciBuildApp;
}
}
}

View File

@ -1,19 +1,15 @@
using Microsoft.AspNet.Hosting;
using Microsoft.Extensions.CommandLineUtils;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using cli.Services;
using System.Threading.Tasks;
using NJsonSchema;
using System.IO;
using cli.Model;
namespace cli
{
public class GenerateJsonSchema
public class GenerateJsonSchema : ICommander
{
public CommandLineApplication Integrates(CommandLineApplication rootApp)
public CommandLineApplication Integrate(CommandLineApplication rootApp)
{
CommandArgument genargclass = null;
CommandArgument genargjson = null;

View File

@ -4,11 +4,12 @@ using Microsoft.Extensions.CommandLineUtils;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using cli.Services;
using cli.Model;
namespace cli {
public class SendMailCommandProvider : ICliCommand {
public CommandLineApplication Integrates(CommandLineApplication rootApp)
public class SendMailCommandProvider : ICommander {
public CommandLineApplication Integrate(CommandLineApplication rootApp)
{
CommandArgument sendMailCommandArg = null;
CommandOption sendHelpOption = null;