2018-07-31 15:24:08 -07: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.
|
|
|
|
|
2018-09-11 12:09:16 -07:00
|
|
|
using System.Collections.Generic;
|
2018-07-31 15:24:08 -07:00
|
|
|
using System.Linq;
|
|
|
|
using Microsoft.DotNet.Cli.CommandLine;
|
|
|
|
using LocalizableStrings = Microsoft.DotNet.Tools.List.PackageReferences.LocalizableStrings;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli
|
|
|
|
{
|
|
|
|
internal static class ListPackageReferencesCommandParser
|
|
|
|
{
|
|
|
|
public static Command ListPackageReferences() => Create.Command(
|
|
|
|
"package",
|
|
|
|
LocalizableStrings.AppFullName,
|
2018-09-11 12:09:16 -07:00
|
|
|
Accept.NoArguments(),
|
2018-07-31 15:24:08 -07:00
|
|
|
CommonOptions.HelpOption(),
|
|
|
|
Create.Option("--outdated",
|
2018-09-11 12:09:16 -07:00
|
|
|
LocalizableStrings.CmdOutdatedDescription,
|
|
|
|
Accept.NoArguments().ForwardAs("--outdated")),
|
2018-07-31 15:24:08 -07:00
|
|
|
Create.Option("--framework",
|
|
|
|
LocalizableStrings.CmdFrameworkDescription,
|
|
|
|
Accept.OneOrMoreArguments()
|
|
|
|
.With(name: LocalizableStrings.CmdFramework)
|
2018-09-11 12:09:16 -07:00
|
|
|
.ForwardAsMany(o => ForwardedArguments("--framework", o.Arguments))),
|
2018-07-31 15:24:08 -07:00
|
|
|
Create.Option("--include-transitive",
|
2018-09-11 12:09:16 -07:00
|
|
|
LocalizableStrings.CmdTransitiveDescription,
|
|
|
|
Accept.NoArguments().ForwardAs("--include-transitive")),
|
2018-07-31 15:24:08 -07:00
|
|
|
Create.Option("--include-prerelease",
|
2018-09-11 12:09:16 -07:00
|
|
|
LocalizableStrings.CmdPrereleaseDescription,
|
|
|
|
Accept.NoArguments().ForwardAs("--include-prerelease")),
|
2018-07-31 15:24:08 -07:00
|
|
|
Create.Option("--highest-patch",
|
2018-09-11 12:09:16 -07:00
|
|
|
LocalizableStrings.CmdHighestPatchDescription,
|
|
|
|
Accept.NoArguments().ForwardAs("--highest-patch")),
|
2018-07-31 15:24:08 -07:00
|
|
|
Create.Option("--highest-minor",
|
2018-09-11 12:09:16 -07:00
|
|
|
LocalizableStrings.CmdHighestMinorDescription,
|
|
|
|
Accept.NoArguments().ForwardAs("--highest-minor")),
|
2018-07-31 15:24:08 -07:00
|
|
|
Create.Option("--config",
|
|
|
|
LocalizableStrings.CmdConfigDescription,
|
|
|
|
Accept.ExactlyOneArgument()
|
|
|
|
.With(name: LocalizableStrings.CmdConfig)
|
2018-09-11 12:09:16 -07:00
|
|
|
.ForwardAsMany(o => new [] { "--config", o.Arguments.Single() })),
|
2018-07-31 15:24:08 -07:00
|
|
|
Create.Option("--source",
|
|
|
|
LocalizableStrings.CmdSourceDescription,
|
|
|
|
Accept.OneOrMoreArguments()
|
|
|
|
.With(name: LocalizableStrings.CmdSource)
|
2018-09-11 12:09:16 -07:00
|
|
|
.ForwardAsMany(o => ForwardedArguments("--source", o.Arguments))));
|
|
|
|
|
|
|
|
private static IEnumerable<string> ForwardedArguments(string token, IEnumerable<string> arguments)
|
|
|
|
{
|
|
|
|
foreach (var arg in arguments)
|
|
|
|
{
|
|
|
|
yield return token;
|
|
|
|
yield return arg;
|
|
|
|
}
|
|
|
|
}
|
2018-07-31 15:24:08 -07:00
|
|
|
}
|
|
|
|
}
|