|
| 1 | +// Copyright (c) .NET Foundation and contributors. All rights reserved. |
| 2 | +// Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| 3 | + |
| 4 | +using System.Linq; |
| 5 | + |
| 6 | +namespace Microsoft.DotNet.Cli.CommandLine |
| 7 | +{ |
| 8 | + internal sealed class CommandLineValidationMessages : IValidationMessages |
| 9 | + { |
| 10 | + public string CommandAcceptsOnlyOneArgument(string command, int argumentCount) => |
| 11 | + string.Format(LocalizableStrings.CommandAcceptsOnlyOneArgument, command, argumentCount); |
| 12 | + |
| 13 | + public string CommandAcceptsOnlyOneSubcommand(string command, string subcommandsSpecified) => |
| 14 | + string.Format(LocalizableStrings.CommandAcceptsOnlyOneSubcommand, command, subcommandsSpecified); |
| 15 | + |
| 16 | + public string FileDoesNotExist(string filePath) => |
| 17 | + string.Format(LocalizableStrings.FileDoesNotExist, filePath); |
| 18 | + |
| 19 | + public string NoArgumentsAllowed(string option) => |
| 20 | + string.Format(LocalizableStrings.NoArgumentsAllowed, option); |
| 21 | + |
| 22 | + public string OptionAcceptsOnlyOneArgument(string option, int argumentCount) => |
| 23 | + string.Format(LocalizableStrings.OptionAcceptsOnlyOneArgument, option, argumentCount); |
| 24 | + |
| 25 | + public string RequiredArgumentMissingForCommand(string command) => |
| 26 | + string.Format(LocalizableStrings.RequiredArgumentMissingForCommand, command); |
| 27 | + |
| 28 | + public string RequiredArgumentMissingForOption(string option) => |
| 29 | + string.Format(LocalizableStrings.RequiredArgumentMissingForOption, option); |
| 30 | + |
| 31 | + public string RequiredCommandWasNotProvided() => |
| 32 | + string.Format(LocalizableStrings.RequiredCommandWasNotProvided); |
| 33 | + |
| 34 | + public string UnrecognizedArgument(string unrecognizedArg, string[] allowedValues) => |
| 35 | + string.Format(LocalizableStrings.UnrecognizedArgument, unrecognizedArg, $"\n\t{string.Join("\n\t", allowedValues.Select(v => $"'{v}'"))}"); |
| 36 | + |
| 37 | + public string UnrecognizedCommandOrArgument(string arg) => |
| 38 | + string.Format(LocalizableStrings.UnrecognizedCommandOrArgument, arg); |
| 39 | + |
| 40 | + public string UnrecognizedOption(string unrecognizedOption, string[] allowedValues) => |
| 41 | + string.Format(LocalizableStrings.UnrecognizedOption, unrecognizedOption, $"\n\t{string.Join("\n\t", allowedValues.Select(v => $"'{v}'"))}"); |
| 42 | + } |
| 43 | +} |
0 commit comments