1f1d0a4d9f
BREAKING CHANGE: Changed the API.
29 lines
853 B
C#
29 lines
853 B
C#
using System;
|
|
using System.CommandLine;
|
|
using System.Linq;
|
|
|
|
namespace MfGames.ToolBuilder
|
|
{
|
|
/// <summary>
|
|
/// Fakes the functionality of the RootCommand because of the given issue:
|
|
/// https://github.com/dotnet/command-line-api/issues/1471
|
|
/// In short, RootCommand doesn't resolve properly when working in certain
|
|
/// situations, mainly having the command line parser in a library that is
|
|
/// called by another executable.
|
|
/// </summary>
|
|
public class FakedRootCommand : Command
|
|
{
|
|
public FakedRootCommand(ToolNames names)
|
|
: base(names.GetExecutableName(), string.Empty)
|
|
{
|
|
}
|
|
|
|
public static string[] GetArguments()
|
|
{
|
|
string[] args = Environment.GetCommandLineArgs();
|
|
|
|
return args.Length == 0 ? args : args.Skip(1).ToArray();
|
|
}
|
|
}
|
|
}
|