public ExitCode Execute() { const int RequiredArgs = 1; if (_args.Count < RequiredArgs) { _outputWriter.Output.WriteLine(StringResources.HelpMetadataListParameters); return(ExitCode.Error); } string filename = _args[0]; if (!_fileWrapper.Exists(filename)) { _outputWriter.Output.WriteLine( string.Format(StringResources.MetadataFileDoesNotExist, filename)); return(ExitCode.Error); } var data = _metadataReader.ReadNames(filename) .OrderBy(str => str) .ToList(); data.ForEach(str => _outputWriter.Output.WriteLine(str)); return(ExitCode.Success); }
public ExitCode Execute() { var configuration = ParseArguments(); if (!ValidConfiguration(configuration)) { configuration.Messages.Where(message => message.IsError == true) .ToList() .ForEach(message => _outputWriter.Error.WriteLine(message.Message)); return(ExitCode.Error); } SetPreconditions(configuration); var entities = string.IsNullOrEmpty(configuration.MetadataFilter) ? _metadataReader.ReadNames(configuration.MetadataPath).ToList() : _metadataReader.ReadNames(configuration.MetadataPath, configuration.MetadataFilter).ToList(); DoTransform(entities, configuration); return(ExitCode.Success); }