using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Amazon.Common.DotNetCli.Tools.Options { /// /// Container for all the command options /// public class CommandOptions { Dictionary _values = new Dictionary(); public int Count { get { return this._values.Count; } } /// /// Gets the list of command line arguments that are not associated with a command option. Currently /// the only valid value for this is function name. /// public IList Arguments { get; } = new List(); /// /// Adds a CommandOption along with its value /// /// /// public void AddOption(CommandOption option, CommandOptionValue value) { _values[option] = value; } /// /// Gets the command option along with its value. The argument is searched for using both the short switch and the full switch. /// /// /// public Tuple FindCommandOption(string argument) { var option = _values.Keys.FirstOrDefault(x => { if (string.Equals(argument, x.ShortSwitch, StringComparison.OrdinalIgnoreCase) || string.Equals(argument, x.Switch, StringComparison.OrdinalIgnoreCase)) return true; return false; }); if (option == null) return null; return new Tuple(option, _values[option]); } /// /// MSBuild parameters that will be passed to the 'dotnet publish' command /// public string MSBuildParameters { get; set; } } }