/// <summary> /// Gets the value for the argument /// </summary> /// <param name="parameterName">Parameter name whose value to get</param> /// <returns>Value of the argument</returns> public string[] GetValue(string parameterName) { if (String.IsNullOrEmpty(parameterName)) { throw new ArgumentException(nameof(parameterName)); } var possibleArgument = Command.GetParameter(parameterName); if (possibleArgument != null) { return(GetValue(possibleArgument)); } else { return(ArgsParsed.ContainsKey(parameterName) ? ArgsParsed[parameterName] : null); } }
/// <summary> /// Gets the value for the argument /// </summary> /// <param name="parameter">Parameter whose value to get</param> /// <returns>Value of the argument</returns> public string[] GetValue(CommandParameter parameter) { if (parameter == null) { throw new ArgumentException(nameof(parameter)); } // Check in arguments parsed var longName = parameter?.GetFullLongName(); var value = ArgsParsed.ContainsKey(longName) ? ArgsParsed[longName] : null; // Check in short names if (value == null) { var shortName = NameMap.ContainsKey(longName) ? NameMap[longName] : null; if (shortName != null) { value = ArgsParsed.ContainsKey(shortName) ? ArgsParsed[shortName] : null; } } return(value); }