public TemplateCommand(TemplateCommandOptions options) { _options = options; if (options.Commands == null || options.Commands.Count == 0 || !Enum.TryParse(options.Commands[0], true, out _commandType)) { throw new InvalidOptionException("Neither 'list' nor 'export' is found. You must specify a command type."); } switch (_commandType) { case TemplateCommandType.Export: _exportTemplateConfig = new ExportTemplateConfig { All = options.All, OutputFolder = options.OutputFolder, Templates = options.Commands.Skip(1).ToArray() }; if (_exportTemplateConfig.Templates.Length == 0) { _exportTemplateConfig.All = true; } break; default: break; } }
public TemplateCommand(TemplateCommandOptions options) { _options = options; if (options.Commands == null || options.Commands.Count == 0 || !Enum.TryParse(options.Commands[0], true, out _commandType)) { throw new InvalidOptionException("Neither 'list' nor 'export' is found"); } switch (_commandType) { case TemplateCommandType.Export: _exportTemplateConfig = new ExportTemplateConfig { All = options.All, OutputFolder = options.OutputFolder, Templates = options.Commands.Skip(1) }; break; default: break; } }