Make non-interactive actually work

pull/5/head
Miepee 4 years ago
parent 4f8bb87696
commit 4b4fba58d8

@ -6,7 +6,7 @@
<RollForward>LatestMajor</RollForward>
<LangVersion>10</LangVersion>
<RootNamespace>AM2RPortHelper</RootNamespace>
<PackageVersion>1.0.0</PackageVersion>
<InformationalVersion>1.3.0</InformationalVersion>
</PropertyGroup>
<ItemGroup>

@ -1,13 +1,15 @@
using System;
using System.CommandLine;
using System.CommandLine.Builder;
using System.IO;
using AM2RPortHelperLib;
namespace AM2RPortHelper;
internal static class Program
{
//TODO: add "-l" flag. transfer launcher mods to each other.
//TODO: add "-l" flag. port launcher mods to different versions.
private static int Main(string[] args)
{
@ -21,10 +23,18 @@ internal static class Program
var macOption = new Option<FileInfo>(new[] { "-m", "--mac" }, "The output file path for the Mac mod. None given equals to no Mac port.");
var nameOption = new Option<string>(new[] { "-n", "--name" }, "The name used for the Mac mod. Required for the Mac option, has no effect on anything else.");
RootCommand rootCommand = new RootCommand();
rootCommand.AddOption(interactiveOption);
RootCommand rootCommand = new RootCommand()
{
interactiveOption,
fileOption,
linuxOption,
androidOption,
macOption,
nameOption
};
rootCommand.SetHandler(RootMethod, interactiveOption, fileOption, linuxOption, androidOption, macOption, nameOption);
return rootCommand.Invoke(args);
/*
@ -76,7 +86,7 @@ internal static class Program
Console.WriteLine("Please provide the full path to the raw mod zip!");
modZipPath = Console.ReadLine();
if (IsValidInputZip(modZipPath))
if (!IsValidInputZip(modZipPath))
Console.WriteLine("Path does not exist, or does not point to a zip file!");
else
invalidZip = false;
@ -143,7 +153,7 @@ internal static class Program
private static bool IsValidInputZip(string path)
{
return path == null || (!File.Exists(path) && Path.GetExtension(path).ToLower() != ".zip");
return path != null && (File.Exists(path) || Path.GetExtension(path).ToLower() == ".zip");
}
private static bool IsValidInputZip(FileInfo path)

@ -4,6 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10</LangVersion>
<PackageVersion>1.8.0</PackageVersion>
</PropertyGroup>
<ItemGroup>

Loading…
Cancel
Save