static string CreateUnpositionedParameter(ICommandInputDescriptor command) { string format = command.IsValueRequired ? "<{1}>" : "[<{1}>]"; format = "-{0} " + format; if (!command.IsRequired) format = "[" + format + "]"; return string.Format(format, command.Name, command.Type); }
string CreateUnpositionedParameter(ICommandInputDescriptor command) { string format = command.IsValueRequired ? "<{1}>" : "[<{1}>]"; format = "-{0} " + format; if (!command.IsRequired) { format = "[" + format + "]"; } return(string.Format(format, command.Name, command.Type)); }
static string CreatePositionedParameter(ICommandInputDescriptor x) { string format; if (x.IsRequired && x.IsValueRequired) format = "[-{0}] <{1}>"; else if (x.IsRequired) format = "-{0} [<{1}>]"; else if (x.IsValueRequired) format = "[[-{0}] <{1}>]"; else format = "(-{0} [<{1}>] | <{1}>)"; return string.Format(format, x.Name, x.Type); }
bool AssignValue(Input input, ICommand command, ICommandInputDescriptor descriptor) { var s = input as SingleValueInput; if (s != null) { return(descriptor.TrySetValue(command, s.Value == string.Empty?Enumerable.Empty <string>() : new[] { s.Value })); } var m = input as MultiValueInput; if (m != null) { return(descriptor.TrySetValue(command, m.Values)); } throw new InvalidOperationException(); }
string CreatePositionedParameter(ICommandInputDescriptor x) { string format = string.Empty; if (x.IsRequired && x.IsValueRequired) { format = "[-{0}] <{1}>"; } else if (x.IsRequired) { format = "-{0} [<{1}>]"; } else if (x.IsValueRequired) { format = "[[-{0}] <{1}>]"; } else { format = "(-{0} [<{1}>] | <{1}>)"; } return(string.Format(format, x.Name, x.Type)); }
string CreateInputDescription(ICommandInputDescriptor input) { return string.Format("\t-{0} <{1}>\r\n\t\t{2}", input.Name, input.Type.Name, input.Description); }
static bool AssignValue(Input input, ICommand command, ICommandInputDescriptor descriptor) { var s = input as SingleValueInput; if (s != null) return descriptor.TrySetValue(command, s.Value == string.Empty ? Enumerable.Empty<string>() : new[] { s.Value }); var m = input as MultiValueInput; if (m != null) return descriptor.TrySetValue(command, m.Values); throw new InvalidOperationException(); }
string CreateInputDescription(ICommandInputDescriptor input) { return(string.Format("\t-{0} <{1}>\r\n\t\t{2}", input.Name, input.Type, input.Description)); }
static bool AssignValue(Input input, ICommand command, ICommandInputDescriptor descriptor) { return descriptor.TrySetValue(command, GetValues(input)); }
string CreateUnpositionedParameter(ICommandInputDescriptor command) { return string.Format(!command.IsRequired ? "[-{0} <{1}>]" : "-{0} <{1}>", command.Name, command.Type.Name); }
string CreatePositionedParameter(ICommandInputDescriptor x) { return string.Format(!x.IsRequired ? "[[-{0}] <{1}>]" : "[-{0}] <{1}>", x.Name, x.Type.Name); }
static bool AssignValue(Input input, ICommand command, ICommandInputDescriptor descriptor) { return(descriptor.TrySetValue(command, GetValues(input))); }