2017-03-06 11:57:19 -08:00
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
|
|
|
|
using System;
|
2017-03-08 16:02:24 -08:00
|
|
|
using System.Linq;
|
2017-03-06 11:57:19 -08:00
|
|
|
using Microsoft.DotNet.Cli.CommandLine;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli
|
|
|
|
{
|
2017-03-08 16:02:24 -08:00
|
|
|
public static class ParserExtensions
|
|
|
|
{
|
|
|
|
public static ParseResult ParseFrom(
|
|
|
|
this CommandLine.Parser parser,
|
|
|
|
string context,
|
|
|
|
string[] args) =>
|
|
|
|
parser.Parse(context.Split(' ').Concat(args).ToArray());
|
|
|
|
}
|
|
|
|
|
2017-03-06 11:57:19 -08:00
|
|
|
public static class ParseResultExtensions
|
|
|
|
{
|
2017-03-08 16:02:24 -08:00
|
|
|
public static void ShowHelp(this ParseResult parseResult) =>
|
2017-03-06 11:57:19 -08:00
|
|
|
Console.WriteLine(parseResult.Command().HelpView());
|
|
|
|
}
|
|
|
|
}
|