private static void writePreview(ISnippetCache cache) { var writer = new TextReport(); writer.StartColumns(2); writer.AddColumnData("Name", "File"); writer.AddDivider('-'); cache.All().Each(snippet => { writer.AddColumnData(snippet.Name, snippet.File); }); writer.WriteToConsole(); }
private static void processDirectory(SnippetsInput input, string directory) { ConsoleWriter.Write(ConsoleColor.White, "Processing code snippets for " + directory); ISnippetCache cache = buildCache(directory); if (input.ScanFlag) { writePreview(cache); } string snippets = directory.AppendPath("snippets"); fileSystem.DeleteDirectory(snippets); string srcDirectory = Environment.CurrentDirectory.AppendPath("src"); Console.WriteLine("Moving snippet files to " + snippets); var writer = new TextReport(); writer.StartColumns(2); writer.AddColumnData("Source", "Destination"); writer.AddDivider('-'); cache.All().Each(snippet => { string relative = snippet.File.PathRelativeTo(srcDirectory).ParentDirectory(); string newPath = snippets.AppendPath(relative); writer.AddColumnData(snippet.File, newPath); fileSystem.CopyToDirectory(snippet.File, newPath); }); if (!input.QuietFlag) { writer.WriteToConsole(); } }
public ProjectViewModel get_project_Name(ProjectRequest request) { var project = TopicGraph.AllTopics.TryFindProject(request.Name); var root = _tokenCache.TopicStructureFor(request.Name); var fileUrl = _urls.UrlFor <FileRequest>(); return(new ProjectViewModel { Name = project.Name, Project = project, Topics = new TopicTreeTag(root), SubmitUrl = _urls.UrlFor(new TopicToken { ProjectName = request.Name }, "POST"), Files = new AllTopicsTag(fileUrl, project), Snippets = new SnippetsTableTag(_urls, _cache.All()), TodoList = new TodoTableTag(fileUrl, TodoTask.FindAllTodos().OrderBy(x => x.File).ThenBy(x => x.Line)) }); }