{"action":"created","comment":{"url":"https://api.github.com/repos/fsprojects/Paket/pulls/comments/23007585","id":23007585,"diff_hunk":"@@ -90,106 +79,68 @@ with\n             | FindRefs _ -> \"finds all references to the given packages.\"\n             | AddCredentials _ -> \"add credentials to config file for the specified source.\"\n \n-\n-let parser = UnionArgParser.Create<CLIArguments>(\"USAGE: paket [add|remove|install|update|outdated|convert-from-nuget|init-auto-restore|simplify|find-refs|config] ... options\")\n  \n-let results =\n-    try\n-        let results = parser.Parse(raiseOnUsage=false)\n-        let command = \n-            if results.Contains <@ CLIArguments.Init @> then Command.Init\n-            elif results.Contains <@ CLIArguments.Add @> then Command.Add\n-            elif results.Contains <@ CLIArguments.Remove @> then Command.Remove\n-            elif results.Contains <@ CLIArguments.Install @> then Command.Install\n-            elif results.Contains <@ CLIArguments.Restore @> then Command.Restore\n-            elif results.Contains <@ CLIArguments.Update @> then Command.Update\n-            elif results.Contains <@ CLIArguments.Outdated @> then Command.Outdated\n-            elif results.Contains <@ CLIArguments.ConvertFromNuget @> then Command.ConvertFromNuget\n-            elif results.Contains <@ CLIArguments.InitAutoRestore @> then Command.InitAutoRestore\n-            elif results.Contains <@ CLIArguments.Simplify @> then Command.Simplify\n-            elif results.Contains <@ CLIArguments.Config @> then Command.Config\n-            elif results.Contains <@ CLIArguments.FindRefs @> then Command.FindRefs\n-            else Command.Unknown\n-        if results.Contains <@ CLIArguments.Verbose @> then\n-            verbose <- true\n-\n-        if results.Contains <@ CLIArguments.Log_File @> then\n-            setLogFile <| results.GetResult <@ CLIArguments.Log_File @> \n-\n-        Some(command,results)\n-    with\n-    | _ ->\n-        tracefn \"%s %s%s\" (String.Join(\" \",Environment.GetCommandLineArgs())) Environment.NewLine (parser.Usage())\n-        None\n+type GlobalArgs =\n+    | [<AltCommandLine(\"-v\")>] Verbose\n+    | Log_File of string\n+with\n+    interface IArgParserTemplate with\n+        member __.Usage = \"\"\n+\n+let filterGlobalArgs args = \n+    let globalResults = \n+        UnionArgParser.Create<GlobalArgs>().Parse(ignoreMissing = true, ignoreUnrecognized = true, raiseOnUsage = false)\n+    let verbose = globalResults.Contains <@ GlobalArgs.Verbose @>\n+    let logFile = globalResults.TryGetResult <@ GlobalArgs.Log_File @> \n+\n+    let rest = \n+        match logFile with\n+        | Some file -> args |> List.filter (fun a -> a <> \"--log-file\" && a <> file)\n+        | None -> args\n+\n+    let rest = \n+        if verbose then rest |> List.filter (fun a -> a <> \"-v\" && a <> \"--verbose\")\n+        else rest\n+\n+    verbose, logFile, rest\n+\n+let showHelp (helpTopic:HelpTexts.CommandHelpTopic) = \n+                        tracefn \"%s\" helpTopic.Title\n+                        tracefn \"%s\" helpTopic.Text\n+\n+let v, logFile, args = filterGlobalArgs (Environment.GetCommandLineArgs() |> Seq.skip 1 |> Seq.toList)\n+\n+let commandArgs<'T when 'T :> IArgParserTemplate> args = \n+    UnionArgParser\n+        .Create<'T>()\n+        .Parse(inputs = Array.ofList args, raiseOnUsage = false, errorHandler = ProcessExiter())\n+\n+Logging.verbose <- v\n+Option.iter setLogFile logFile\n \n try\n-    match results with\n-    | Some(command,results) ->\n-        let force = results.Contains <@ CLIArguments.Force @> \n-        let interactive = results.Contains <@ CLIArguments.Interactive @> \n-        let hard = results.Contains <@ CLIArguments.Hard @> \n-        let noInstall = results.Contains <@ CLIArguments.No_Install @>\n-        let noAutoRestore = results.Contains <@ CLIArguments.No_Auto_Restore @>\n-        let includePrereleases = results.Contains <@ CLIArguments.Include_Prereleases @> \n-        let withBindingRedirects = results.Contains <@ CLIArguments.Redirects @>\n-\n-        if results.IsUsageRequested then \n-            let showHelp (helpTopic:HelpTexts.CommandHelpTopic) = \n-                tracefn \"%s\" helpTopic.Title\n-                tracefn \"%s\" helpTopic.Text\n-\n-            match command with\n-            | Command.Init -> showHelp HelpTexts.commands.[\"init\"]\n-            | Command.Add -> showHelp HelpTexts.commands.[\"add\"]\n-            | Command.Remove -> showHelp HelpTexts.commands.[\"remove\"]\n-            | Command.Install -> showHelp HelpTexts.commands.[\"install\"]\n-            | Command.Restore -> showHelp HelpTexts.commands.[\"restore\"]\n-            | Command.Update -> showHelp HelpTexts.commands.[\"update\"]\n-            | Command.Outdated -> showHelp HelpTexts.commands.[\"outdated\"]\n-            | Command.InitAutoRestore -> showHelp HelpTexts.commands.[\"init-auto-restore\"]\n-            | Command.ConvertFromNuget -> showHelp HelpTexts.commands.[\"convert-from-nuget\"]\n-            | Command.Simplify -> showHelp HelpTexts.commands.[\"simplify\"]\n-            | Command.FindRefs -> showHelp HelpTexts.commands.[\"find-refs\"]\n-            | Command.Config -> showHelp HelpTexts.commands.[\"config\"]\n-            | Command.Unknown -> traceErrorfn \"no command given.%s\" (parser.Usage())\n-\n-        else\n-            match command with\n-            | Command.Init -> Dependencies.Init()\n-            | Command.Add -> \n-                let packageName = results.GetResult <@ CLIArguments.Nuget @>\n-                let version = \n-                    match results.TryGetResult <@ CLIArguments.Version @> with\n-                    | Some x -> x\n-                    | _ -> \"\"\n+    match args with\n+        | \"add\" :: args ->","path":"src/Paket/Program.fs","position":153,"original_position":153,"commit_id":"9e14d298e8705f834c3b74207e9a268afc3ffc7e","original_commit_id":"9e14d298e8705f834c3b74207e9a268afc3ffc7e","user":{"login":"theimowski","id":5909015,"avatar_url":"https://avatars.githubusercontent.com/u/5909015?v=3","gravatar_id":"","url":"https://api.github.com/users/theimowski","html_url":"https://github.com/theimowski","followers_url":"https://api.github.com/users/theimowski/followers","following_url":"https://api.github.com/users/theimowski/following{/other_user}","gists_url":"https://api.github.com/users/theimowski/gists{/gist_id}","starred_url":"https://api.github.com/users/theimowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theimowski/subscriptions","organizations_url":"https://api.github.com/users/theimowski/orgs","repos_url":"https://api.github.com/users/theimowski/repos","events_url":"https://api.github.com/users/theimowski/events{/privacy}","received_events_url":"https://api.github.com/users/theimowski/received_events","type":"User","site_admin":false},"body":"Hm I'll see what I can do to bring the Commands DU back. @mexx what type of redundancy? You mean arguments that are applicable to more than one command?","created_at":"2015-01-15T12:58:04Z","updated_at":"2015-01-15T12:58:04Z","html_url":"https://github.com/fsprojects/Paket/pull/551#discussion_r23007585","pull_request_url":"https://api.github.com/repos/fsprojects/Paket/pulls/551","_links":{"self":{"href":"https://api.github.com/repos/fsprojects/Paket/pulls/comments/23007585"},"html":{"href":"https://github.com/fsprojects/Paket/pull/551#discussion_r23007585"},"pull_request":{"href":"https://api.github.com/repos/fsprojects/Paket/pulls/551"}}},"pull_request":{"url":"https://api.github.com/repos/fsprojects/Paket/pulls/551","id":27365844,"html_url":"https://github.com/fsprojects/Paket/pull/551","diff_url":"https://github.com/fsprojects/Paket/pull/551.diff","patch_url":"https://github.com/fsprojects/Paket/pull/551.patch","issue_url":"https://api.github.com/repos/fsprojects/Paket/issues/551","number":551,"state":"open","locked":false,"title":"WIP: Separate args for each command","user":{"login":"theimowski","id":5909015,"avatar_url":"https://avatars.githubusercontent.com/u/5909015?v=3","gravatar_id":"","url":"https://api.github.com/users/theimowski","html_url":"https://github.com/theimowski","followers_url":"https://api.github.com/users/theimowski/followers","following_url":"https://api.github.com/users/theimowski/following{/other_user}","gists_url":"https://api.github.com/users/theimowski/gists{/gist_id}","starred_url":"https://api.github.com/users/theimowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theimowski/subscriptions","organizations_url":"https://api.github.com/users/theimowski/orgs","repos_url":"https://api.github.com/users/theimowski/repos","events_url":"https://api.github.com/users/theimowski/events{/privacy}","received_events_url":"https://api.github.com/users/theimowski/received_events","type":"User","site_admin":false},"body":"Because Paket.exe is always to be invoked with a given command, I thought it would be nice to separate arguments for each of the commands.\r\n\r\n - clearer view of which command uses what arguments\r\n - easier to express the syntax of commands (see f.e issue in #511)\r\n - good way to maintain the command line help (will need to fill in the usage for arguments)\r\n - potential for automated (build process) command syntax in markdown docs\r\n\r\nTell me what you think, if you give green light I'll proceed with filling up the usages, and what else gives.","created_at":"2015-01-14T17:10:17Z","updated_at":"2015-01-15T12:58:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81b4bd415c72f91e038d59bdbfc77eb287957e8c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fsprojects/Paket/pulls/551/commits","review_comments_url":"https://api.github.com/repos/fsprojects/Paket/pulls/551/comments","review_comment_url":"https://api.github.com/repos/fsprojects/Paket/pulls/comments/{number}","comments_url":"https://api.github.com/repos/fsprojects/Paket/issues/551/comments","statuses_url":"https://api.github.com/repos/fsprojects/Paket/statuses/9e14d298e8705f834c3b74207e9a268afc3ffc7e","head":{"label":"theimowski:separate_args_for_each_command","ref":"separate_args_for_each_command","sha":"9e14d298e8705f834c3b74207e9a268afc3ffc7e","user":{"login":"theimowski","id":5909015,"avatar_url":"https://avatars.githubusercontent.com/u/5909015?v=3","gravatar_id":"","url":"https://api.github.com/users/theimowski","html_url":"https://github.com/theimowski","followers_url":"https://api.github.com/users/theimowski/followers","following_url":"https://api.github.com/users/theimowski/following{/other_user}","gists_url":"https://api.github.com/users/theimowski/gists{/gist_id}","starred_url":"https://api.github.com/users/theimowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theimowski/subscriptions","organizations_url":"https://api.github.com/users/theimowski/orgs","repos_url":"https://api.github.com/users/theimowski/repos","events_url":"https://api.github.com/users/theimowski/events{/privacy}","received_events_url":"https://api.github.com/users/theimowski/received_events","type":"User","site_admin":false},"repo":{"id":23591212,"name":"Paket","full_name":"theimowski/Paket","owner":{"login":"theimowski","id":5909015,"avatar_url":"https://avatars.githubusercontent.com/u/5909015?v=3","gravatar_id":"","url":"https://api.github.com/users/theimowski","html_url":"https://github.com/theimowski","followers_url":"https://api.github.com/users/theimowski/followers","following_url":"https://api.github.com/users/theimowski/following{/other_user}","gists_url":"https://api.github.com/users/theimowski/gists{/gist_id}","starred_url":"https://api.github.com/users/theimowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theimowski/subscriptions","organizations_url":"https://api.github.com/users/theimowski/orgs","repos_url":"https://api.github.com/users/theimowski/repos","events_url":"https://api.github.com/users/theimowski/events{/privacy}","received_events_url":"https://api.github.com/users/theimowski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/theimowski/Paket","description":"A package dependency manager for .NET","fork":true,"url":"https://api.github.com/repos/theimowski/Paket","forks_url":"https://api.github.com/repos/theimowski/Paket/forks","keys_url":"https://api.github.com/repos/theimowski/Paket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/theimowski/Paket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/theimowski/Paket/teams","hooks_url":"https://api.github.com/repos/theimowski/Paket/hooks","issue_events_url":"https://api.github.com/repos/theimowski/Paket/issues/events{/number}","events_url":"https://api.github.com/repos/theimowski/Paket/events","assignees_url":"https://api.github.com/repos/theimowski/Paket/assignees{/user}","branches_url":"https://api.github.com/repos/theimowski/Paket/branches{/branch}","tags_url":"https://api.github.com/repos/theimowski/Paket/tags","blobs_url":"https://api.github.com/repos/theimowski/Paket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/theimowski/Paket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/theimowski/Paket/git/refs{/sha}","trees_url":"https://api.github.com/repos/theimowski/Paket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/theimowski/Paket/statuses/{sha}","languages_url":"https://api.github.com/repos/theimowski/Paket/languages","stargazers_url":"https://api.github.com/repos/theimowski/Paket/stargazers","contributors_url":"https://api.github.com/repos/theimowski/Paket/contributors","subscribers_url":"https://api.github.com/repos/theimowski/Paket/subscribers","subscription_url":"https://api.github.com/repos/theimowski/Paket/subscription","commits_url":"https://api.github.com/repos/theimowski/Paket/commits{/sha}","git_commits_url":"https://api.github.com/repos/theimowski/Paket/git/commits{/sha}","comments_url":"https://api.github.com/repos/theimowski/Paket/comments{/number}","issue_comment_url":"https://api.github.com/repos/theimowski/Paket/issues/comments/{number}","contents_url":"https://api.github.com/repos/theimowski/Paket/contents/{+path}","compare_url":"https://api.github.com/repos/theimowski/Paket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/theimowski/Paket/merges","archive_url":"https://api.github.com/repos/theimowski/Paket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/theimowski/Paket/downloads","issues_url":"https://api.github.com/repos/theimowski/Paket/issues{/number}","pulls_url":"https://api.github.com/repos/theimowski/Paket/pulls{/number}","milestones_url":"https://api.github.com/repos/theimowski/Paket/milestones{/number}","notifications_url":"https://api.github.com/repos/theimowski/Paket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/theimowski/Paket/labels{/name}","releases_url":"https://api.github.com/repos/theimowski/Paket/releases{/id}","created_at":"2014-09-02T18:51:23Z","updated_at":"2015-01-14T14:51:40Z","pushed_at":"2015-01-14T17:12:00Z","git_url":"git://github.com/theimowski/Paket.git","ssh_url":"git@github.com:theimowski/Paket.git","clone_url":"https://github.com/theimowski/Paket.git","svn_url":"https://github.com/theimowski/Paket","homepage":"http://fsprojects.github.io/Paket/","size":5787,"stargazers_count":0,"watchers_count":0,"language":"F#","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fsprojects:master","ref":"master","sha":"46590d4067682cf5b167592c2bfdc63d4a456c9e","user":{"login":"fsprojects","id":6001315,"avatar_url":"https://avatars.githubusercontent.com/u/6001315?v=3","gravatar_id":"","url":"https://api.github.com/users/fsprojects","html_url":"https://github.com/fsprojects","followers_url":"https://api.github.com/users/fsprojects/followers","following_url":"https://api.github.com/users/fsprojects/following{/other_user}","gists_url":"https://api.github.com/users/fsprojects/gists{/gist_id}","starred_url":"https://api.github.com/users/fsprojects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsprojects/subscriptions","organizations_url":"https://api.github.com/users/fsprojects/orgs","repos_url":"https://api.github.com/users/fsprojects/repos","events_url":"https://api.github.com/users/fsprojects/events{/privacy}","received_events_url":"https://api.github.com/users/fsprojects/received_events","type":"Organization","site_admin":false},"repo":{"id":22755810,"name":"Paket","full_name":"fsprojects/Paket","owner":{"login":"fsprojects","id":6001315,"avatar_url":"https://avatars.githubusercontent.com/u/6001315?v=3","gravatar_id":"","url":"https://api.github.com/users/fsprojects","html_url":"https://github.com/fsprojects","followers_url":"https://api.github.com/users/fsprojects/followers","following_url":"https://api.github.com/users/fsprojects/following{/other_user}","gists_url":"https://api.github.com/users/fsprojects/gists{/gist_id}","starred_url":"https://api.github.com/users/fsprojects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsprojects/subscriptions","organizations_url":"https://api.github.com/users/fsprojects/orgs","repos_url":"https://api.github.com/users/fsprojects/repos","events_url":"https://api.github.com/users/fsprojects/events{/privacy}","received_events_url":"https://api.github.com/users/fsprojects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fsprojects/Paket","description":"A package dependency manager for .NET with support for NuGet packages and GitHub repositories.","fork":false,"url":"https://api.github.com/repos/fsprojects/Paket","forks_url":"https://api.github.com/repos/fsprojects/Paket/forks","keys_url":"https://api.github.com/repos/fsprojects/Paket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fsprojects/Paket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fsprojects/Paket/teams","hooks_url":"https://api.github.com/repos/fsprojects/Paket/hooks","issue_events_url":"https://api.github.com/repos/fsprojects/Paket/issues/events{/number}","events_url":"https://api.github.com/repos/fsprojects/Paket/events","assignees_url":"https://api.github.com/repos/fsprojects/Paket/assignees{/user}","branches_url":"https://api.github.com/repos/fsprojects/Paket/branches{/branch}","tags_url":"https://api.github.com/repos/fsprojects/Paket/tags","blobs_url":"https://api.github.com/repos/fsprojects/Paket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fsprojects/Paket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fsprojects/Paket/git/refs{/sha}","trees_url":"https://api.github.com/repos/fsprojects/Paket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fsprojects/Paket/statuses/{sha}","languages_url":"https://api.github.com/repos/fsprojects/Paket/languages","stargazers_url":"https://api.github.com/repos/fsprojects/Paket/stargazers","contributors_url":"https://api.github.com/repos/fsprojects/Paket/contributors","subscribers_url":"https://api.github.com/repos/fsprojects/Paket/subscribers","subscription_url":"https://api.github.com/repos/fsprojects/Paket/subscription","commits_url":"https://api.github.com/repos/fsprojects/Paket/commits{/sha}","git_commits_url":"https://api.github.com/repos/fsprojects/Paket/git/commits{/sha}","comments_url":"https://api.github.com/repos/fsprojects/Paket/comments{/number}","issue_comment_url":"https://api.github.com/repos/fsprojects/Paket/issues/comments/{number}","contents_url":"https://api.github.com/repos/fsprojects/Paket/contents/{+path}","compare_url":"https://api.github.com/repos/fsprojects/Paket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fsprojects/Paket/merges","archive_url":"https://api.github.com/repos/fsprojects/Paket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fsprojects/Paket/downloads","issues_url":"https://api.github.com/repos/fsprojects/Paket/issues{/number}","pulls_url":"https://api.github.com/repos/fsprojects/Paket/pulls{/number}","milestones_url":"https://api.github.com/repos/fsprojects/Paket/milestones{/number}","notifications_url":"https://api.github.com/repos/fsprojects/Paket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fsprojects/Paket/labels{/name}","releases_url":"https://api.github.com/repos/fsprojects/Paket/releases{/id}","created_at":"2014-08-08T11:36:13Z","updated_at":"2015-01-15T09:45:56Z","pushed_at":"2015-01-15T09:45:56Z","git_url":"git://github.com/fsprojects/Paket.git","ssh_url":"git@github.com:fsprojects/Paket.git","clone_url":"https://github.com/fsprojects/Paket.git","svn_url":"https://github.com/fsprojects/Paket","homepage":"http://fsprojects.github.io/Paket/","size":23071,"stargazers_count":181,"watchers_count":181,"language":"F#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":56,"mirror_url":null,"open_issues_count":57,"forks":56,"open_issues":57,"watchers":181,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fsprojects/Paket/pulls/551"},"html":{"href":"https://github.com/fsprojects/Paket/pull/551"},"issue":{"href":"https://api.github.com/repos/fsprojects/Paket/issues/551"},"comments":{"href":"https://api.github.com/repos/fsprojects/Paket/issues/551/comments"},"review_comments":{"href":"https://api.github.com/repos/fsprojects/Paket/pulls/551/comments"},"review_comment":{"href":"https://api.github.com/repos/fsprojects/Paket/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/fsprojects/Paket/pulls/551/commits"},"statuses":{"href":"https://api.github.com/repos/fsprojects/Paket/statuses/9e14d298e8705f834c3b74207e9a268afc3ffc7e"}}}}