{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefxlab/pulls/comments/32966114","id":32966114,"diff_hunk":"@@ -0,0 +1,241 @@\n+using System;\n+using System.IO;\n+using Newtonsoft.Json;\n+using System.Collections.Generic;\n+\n+public class Program\n+{\n+    private static void Main (string[] args)\n+    {\n+        // project.lock.json reader\n+        // See PrintHelp for arg info\n+        \n+        const string Lockfile = \"project.lock.json\";\n+        Project project;\n+        \n+        Console.WriteLine(\"project.json.lock file reader\");\n+        \n+        using (var reader = new StreamReader(Lockfile))\n+        {\n+            project = JsonConvert.DeserializeObject<Project>(reader.ReadToEnd());\n+        }\n+        \n+        if (args == null || args.Length == 0)\n+        {\n+            PrintTargets(project);\n+            Console.WriteLine();\n+            Console.WriteLine(\"Use --help argument to print help.\");\n+        }\n+        else\n+        {\n+            var commands = GetArguments(args);\n+            const string Target = \"--target\";\n+            const string Copy = \"--copy\";\n+            const string Verbose = \"--verbose\";\n+            const string Help = \"--help\";\n+            \n+            if (commands == null)\n+            {\n+                Console.WriteLine(\"Bad argument!\");\n+                Console.WriteLine();\n+                PrintHelp();\n+            }\n+            else if (commands.ContainsKey(\"--targets\"))\n+            {\n+                PrintTargets(project);\n+            }\n+            else if (commands.ContainsKey(Target) && commands.ContainsKey(Copy) && !string.IsNullOrEmpty(commands[Copy]))\n+            {\n+                bool verbose = commands.ContainsKey(Verbose);\n+                CopyTarget(project, commands[Target], commands[Copy], verbose);\n+            }\n+            else if (commands.ContainsKey(Target))\n+            {\n+                bool verbose = commands.ContainsKey(Verbose);\n+                PrintTarget(project,commands[Target], verbose);\n+            }\n+            else if (commands.ContainsKey(Help))\n+            {\n+                Console.WriteLine();\n+                PrintHelp();\n+            }\n+        }\n+    }\n+    \n+    private static void PrintTargets(Project project)\n+    {\n+        Console.WriteLine (\"This project has {0} targets.\", project.Targets.Count);\n+        Console.WriteLine();\n+        \n+        foreach (var t in project.Targets.Keys)\n+        {\n+            Console.WriteLine(t);\n+        }\n+    }\n+    \n+    private static void PrintTarget(Project project, string target, bool verbose = false)\n+    {\n+        Dictionary<string,Package> packages;\n+        var targetFound = project.Targets.TryGetValue(target, out packages);\n+        \n+        if (targetFound && packages.Count > 0)\n+        {\n+            Console.WriteLine(\"Package dependencies for target: {0}\",target);\n+            \n+            foreach (var package in packages.Keys)\n+            {\n+                Console.WriteLine(package);\n+                if (verbose)\n+                {\n+                    var p = packages[package];\n+               \n+                    if (p.Compile != null)\n+                    {\n+                        foreach (var key in p.Compile.Keys)\n+                        {\n+                            Console.WriteLine(\"**Compile: {0}\", key);\n+                        }\n+                    }\n+                    \n+                    if (p.Runtime != null)\n+                    {\n+                        foreach (var key in p.Runtime.Keys)\n+                        {\n+                            Console.WriteLine(\"**Runtime: {0}\", key);\n+                        }\n+                    }\n+                    \n+                    if (p.Dependencies != null)\n+                    {\n+                        foreach (var key in p.Dependencies.Keys)\n+                        {\n+                            Console.WriteLine(\"**Dependencies: {0}\", key);\n+                        }\n+                    }\n+                }\n+            }\n+        }\n+        else if (targetFound)\n+        {\n+            Console.WriteLine(\"No packages found for {0}.\",target);\n+        }\n+        else\n+        {\n+            Console.WriteLine(\"{0} is not a target for this project.\", target);\n+        }\n+    }    \n+    \n+    private static void CopyTarget(Project project, string target, string path, bool verbose = false)\n+    {\n+        const string packageRoot = \"/Users/richlander/.dnx/packages\";","path":"tools/dnulist/program.cs","position":130,"original_position":130,"commit_id":"b911b9118dbb36cb4ebc9ea8ad51266751e8e6cc","original_commit_id":"b911b9118dbb36cb4ebc9ea8ad51266751e8e6cc","user":{"login":"ericstj","id":8918108,"avatar_url":"https://avatars.githubusercontent.com/u/8918108?v=3","gravatar_id":"","url":"https://api.github.com/users/ericstj","html_url":"https://github.com/ericstj","followers_url":"https://api.github.com/users/ericstj/followers","following_url":"https://api.github.com/users/ericstj/following{/other_user}","gists_url":"https://api.github.com/users/ericstj/gists{/gist_id}","starred_url":"https://api.github.com/users/ericstj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericstj/subscriptions","organizations_url":"https://api.github.com/users/ericstj/orgs","repos_url":"https://api.github.com/users/ericstj/repos","events_url":"https://api.github.com/users/ericstj/events{/privacy}","received_events_url":"https://api.github.com/users/ericstj/received_events","type":"User","site_admin":false},"body":"The environment variable is defined by DNVM, not DNX.  If not the environment variable then force folks to pass it in.  You shouldn't be making an assumption about where nuget/DNX decides to store it's packages.  The location is configurable and not part of any \"public contract\".","created_at":"2015-06-22T18:21:50Z","updated_at":"2015-06-22T18:21:50Z","html_url":"https://github.com/dotnet/corefxlab/pull/106#discussion_r32966114","pull_request_url":"https://api.github.com/repos/dotnet/corefxlab/pulls/106","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefxlab/pulls/comments/32966114"},"html":{"href":"https://github.com/dotnet/corefxlab/pull/106#discussion_r32966114"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefxlab/pulls/106"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefxlab/pulls/106","id":37964971,"html_url":"https://github.com/dotnet/corefxlab/pull/106","diff_url":"https://github.com/dotnet/corefxlab/pull/106.diff","patch_url":"https://github.com/dotnet/corefxlab/pull/106.patch","issue_url":"https://api.github.com/repos/dotnet/corefxlab/issues/106","number":106,"state":"open","locked":false,"title":"Add dnulist tool","user":{"login":"richlander","id":2608468,"avatar_url":"https://avatars.githubusercontent.com/u/2608468?v=3","gravatar_id":"","url":"https://api.github.com/users/richlander","html_url":"https://github.com/richlander","followers_url":"https://api.github.com/users/richlander/followers","following_url":"https://api.github.com/users/richlander/following{/other_user}","gists_url":"https://api.github.com/users/richlander/gists{/gist_id}","starred_url":"https://api.github.com/users/richlander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richlander/subscriptions","organizations_url":"https://api.github.com/users/richlander/orgs","repos_url":"https://api.github.com/users/richlander/repos","events_url":"https://api.github.com/users/richlander/events{/privacy}","received_events_url":"https://api.github.com/users/richlander/received_events","type":"User","site_admin":false},"body":"This is a tool that is intended to solve the problem of using NuGet package artifacts w/o needing to understand the format / binding semantics. This is discussed here: https://github.com/dotnet/coreclr/issues/995.\r\n\r\nThe tool overlaps a fair bit with dnu. Hopefully, this functionality is added to dnu. Currently, the tool has the following basic functions:\r\n\r\n- List targets.\r\n- List packages by target.\r\n- Copy packages to a directory, by target.\r\n\r\n@davidfowl, @ericstj, @blackdwarf, @akoeplinger, @KrzysztofCwalina ","created_at":"2015-06-18T01:52:48Z","updated_at":"2015-06-22T18:21:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a2ab160618c53c1ce25db44fca5a66540d656a3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefxlab/pulls/106/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefxlab/pulls/106/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefxlab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefxlab/issues/106/comments","statuses_url":"https://api.github.com/repos/dotnet/corefxlab/statuses/b911b9118dbb36cb4ebc9ea8ad51266751e8e6cc","head":{"label":"richlander:rich-dnulist","ref":"rich-dnulist","sha":"b911b9118dbb36cb4ebc9ea8ad51266751e8e6cc","user":{"login":"richlander","id":2608468,"avatar_url":"https://avatars.githubusercontent.com/u/2608468?v=3","gravatar_id":"","url":"https://api.github.com/users/richlander","html_url":"https://github.com/richlander","followers_url":"https://api.github.com/users/richlander/followers","following_url":"https://api.github.com/users/richlander/following{/other_user}","gists_url":"https://api.github.com/users/richlander/gists{/gist_id}","starred_url":"https://api.github.com/users/richlander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richlander/subscriptions","organizations_url":"https://api.github.com/users/richlander/orgs","repos_url":"https://api.github.com/users/richlander/repos","events_url":"https://api.github.com/users/richlander/events{/privacy}","received_events_url":"https://api.github.com/users/richlander/received_events","type":"User","site_admin":false},"repo":{"id":37631171,"name":"corefxlab","full_name":"richlander/corefxlab","owner":{"login":"richlander","id":2608468,"avatar_url":"https://avatars.githubusercontent.com/u/2608468?v=3","gravatar_id":"","url":"https://api.github.com/users/richlander","html_url":"https://github.com/richlander","followers_url":"https://api.github.com/users/richlander/followers","following_url":"https://api.github.com/users/richlander/following{/other_user}","gists_url":"https://api.github.com/users/richlander/gists{/gist_id}","starred_url":"https://api.github.com/users/richlander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richlander/subscriptions","organizations_url":"https://api.github.com/users/richlander/orgs","repos_url":"https://api.github.com/users/richlander/repos","events_url":"https://api.github.com/users/richlander/events{/privacy}","received_events_url":"https://api.github.com/users/richlander/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/richlander/corefxlab","description":"This repo is for experimentation and exploring new ideas that may or may not make it into the main corefx repo.","fork":true,"url":"https://api.github.com/repos/richlander/corefxlab","forks_url":"https://api.github.com/repos/richlander/corefxlab/forks","keys_url":"https://api.github.com/repos/richlander/corefxlab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/richlander/corefxlab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/richlander/corefxlab/teams","hooks_url":"https://api.github.com/repos/richlander/corefxlab/hooks","issue_events_url":"https://api.github.com/repos/richlander/corefxlab/issues/events{/number}","events_url":"https://api.github.com/repos/richlander/corefxlab/events","assignees_url":"https://api.github.com/repos/richlander/corefxlab/assignees{/user}","branches_url":"https://api.github.com/repos/richlander/corefxlab/branches{/branch}","tags_url":"https://api.github.com/repos/richlander/corefxlab/tags","blobs_url":"https://api.github.com/repos/richlander/corefxlab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/richlander/corefxlab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/richlander/corefxlab/git/refs{/sha}","trees_url":"https://api.github.com/repos/richlander/corefxlab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/richlander/corefxlab/statuses/{sha}","languages_url":"https://api.github.com/repos/richlander/corefxlab/languages","stargazers_url":"https://api.github.com/repos/richlander/corefxlab/stargazers","contributors_url":"https://api.github.com/repos/richlander/corefxlab/contributors","subscribers_url":"https://api.github.com/repos/richlander/corefxlab/subscribers","subscription_url":"https://api.github.com/repos/richlander/corefxlab/subscription","commits_url":"https://api.github.com/repos/richlander/corefxlab/commits{/sha}","git_commits_url":"https://api.github.com/repos/richlander/corefxlab/git/commits{/sha}","comments_url":"https://api.github.com/repos/richlander/corefxlab/comments{/number}","issue_comment_url":"https://api.github.com/repos/richlander/corefxlab/issues/comments{/number}","contents_url":"https://api.github.com/repos/richlander/corefxlab/contents/{+path}","compare_url":"https://api.github.com/repos/richlander/corefxlab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/richlander/corefxlab/merges","archive_url":"https://api.github.com/repos/richlander/corefxlab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/richlander/corefxlab/downloads","issues_url":"https://api.github.com/repos/richlander/corefxlab/issues{/number}","pulls_url":"https://api.github.com/repos/richlander/corefxlab/pulls{/number}","milestones_url":"https://api.github.com/repos/richlander/corefxlab/milestones{/number}","notifications_url":"https://api.github.com/repos/richlander/corefxlab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/richlander/corefxlab/labels{/name}","releases_url":"https://api.github.com/repos/richlander/corefxlab/releases{/id}","created_at":"2015-06-18T01:46:47Z","updated_at":"2015-06-18T01:46:48Z","pushed_at":"2015-06-18T01:56:35Z","git_url":"git://github.com/richlander/corefxlab.git","ssh_url":"git@github.com:richlander/corefxlab.git","clone_url":"https://github.com/richlander/corefxlab.git","svn_url":"https://github.com/richlander/corefxlab","homepage":"","size":8683,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"2b5777feaf4620c380df2d8bd9a7f5807cb160d3","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":29504192,"name":"corefxlab","full_name":"dotnet/corefxlab","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefxlab","description":"This repo is for experimentation and exploring new ideas that may or may not make it into the main corefx repo.","fork":false,"url":"https://api.github.com/repos/dotnet/corefxlab","forks_url":"https://api.github.com/repos/dotnet/corefxlab/forks","keys_url":"https://api.github.com/repos/dotnet/corefxlab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefxlab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefxlab/teams","hooks_url":"https://api.github.com/repos/dotnet/corefxlab/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefxlab/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefxlab/events","assignees_url":"https://api.github.com/repos/dotnet/corefxlab/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefxlab/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefxlab/tags","blobs_url":"https://api.github.com/repos/dotnet/corefxlab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefxlab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefxlab/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefxlab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefxlab/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefxlab/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefxlab/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefxlab/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefxlab/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefxlab/subscription","commits_url":"https://api.github.com/repos/dotnet/corefxlab/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefxlab/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefxlab/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefxlab/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefxlab/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefxlab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefxlab/merges","archive_url":"https://api.github.com/repos/dotnet/corefxlab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefxlab/downloads","issues_url":"https://api.github.com/repos/dotnet/corefxlab/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefxlab/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefxlab/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefxlab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefxlab/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefxlab/releases{/id}","created_at":"2015-01-20T00:44:35Z","updated_at":"2015-06-17T05:48:08Z","pushed_at":"2015-06-18T01:56:35Z","git_url":"git://github.com/dotnet/corefxlab.git","ssh_url":"git@github.com:dotnet/corefxlab.git","clone_url":"https://github.com/dotnet/corefxlab.git","svn_url":"https://github.com/dotnet/corefxlab","homepage":"","size":8683,"stargazers_count":85,"watchers_count":85,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":44,"mirror_url":null,"open_issues_count":30,"forks":44,"open_issues":30,"watchers":85,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefxlab/pulls/106"},"html":{"href":"https://github.com/dotnet/corefxlab/pull/106"},"issue":{"href":"https://api.github.com/repos/dotnet/corefxlab/issues/106"},"comments":{"href":"https://api.github.com/repos/dotnet/corefxlab/issues/106/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefxlab/pulls/106/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefxlab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefxlab/pulls/106/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefxlab/statuses/b911b9118dbb36cb4ebc9ea8ad51266751e8e6cc"}}}}