{"action":"created","issue":{"url":"https://api.github.com/repos/RexOps/Rex/issues/779","labels_url":"https://api.github.com/repos/RexOps/Rex/issues/779/labels{/name}","comments_url":"https://api.github.com/repos/RexOps/Rex/issues/779/comments","events_url":"https://api.github.com/repos/RexOps/Rex/issues/779/events","html_url":"https://github.com/RexOps/Rex/pull/779","id":104133502,"number":779,"title":"Better argument parsing to support task chaining","user":{"login":"kablamo","id":104742,"avatar_url":"https://avatars.githubusercontent.com/u/104742?v=3","gravatar_id":"","url":"https://api.github.com/users/kablamo","html_url":"https://github.com/kablamo","followers_url":"https://api.github.com/users/kablamo/followers","following_url":"https://api.github.com/users/kablamo/following{/other_user}","gists_url":"https://api.github.com/users/kablamo/gists{/gist_id}","starred_url":"https://api.github.com/users/kablamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kablamo/subscriptions","organizations_url":"https://api.github.com/users/kablamo/orgs","repos_url":"https://api.github.com/users/kablamo/repos","events_url":"https://api.github.com/users/kablamo/events{/privacy}","received_events_url":"https://api.github.com/users/kablamo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/RexOps/Rex/milestones/48","html_url":"https://github.com/RexOps/Rex/milestones/1.4.0","labels_url":"https://api.github.com/repos/RexOps/Rex/milestones/48/labels","id":1141097,"number":48,"title":"1.4.0","description":"","creator":{"login":"ferki","id":3117609,"avatar_url":"https://avatars.githubusercontent.com/u/3117609?v=3","gravatar_id":"","url":"https://api.github.com/users/ferki","html_url":"https://github.com/ferki","followers_url":"https://api.github.com/users/ferki/followers","following_url":"https://api.github.com/users/ferki/following{/other_user}","gists_url":"https://api.github.com/users/ferki/gists{/gist_id}","starred_url":"https://api.github.com/users/ferki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferki/subscriptions","organizations_url":"https://api.github.com/users/ferki/orgs","repos_url":"https://api.github.com/users/ferki/repos","events_url":"https://api.github.com/users/ferki/events{/privacy}","received_events_url":"https://api.github.com/users/ferki/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":13,"state":"open","created_at":"2015-05-30T08:52:31Z","updated_at":"2015-10-30T05:15:40Z","due_on":null,"closed_at":null},"comments":21,"created_at":"2015-08-31T20:59:58Z","updated_at":"2015-10-30T06:20:27Z","closed_at":"2015-10-26T17:13:29Z","pull_request":{"url":"https://api.github.com/repos/RexOps/Rex/pulls/779","html_url":"https://github.com/RexOps/Rex/pull/779","diff_url":"https://github.com/RexOps/Rex/pull/779.diff","patch_url":"https://github.com/RexOps/Rex/pull/779.patch"},"body":"# Overview\r\n\r\nCurrently rex has very limited support for task chaining.  The following works:\r\n```\r\nrex task1 task2 task3\r\n```\r\n\r\nBut as soon as you start passing options to tasks, things break down in a couple of ways.  The goal of this pr is to fix this.\r\n\r\n# Concepts\r\n\r\nA `Rex::TaskList` object holds a *hash* defining every task defined in a user's Rexfile.\r\n\r\nA `Rex::RunList` object holds a *list* of all the `Rex::Task` objects that are going to get executed in a single run of rex.  In other words, it contains all the tasks specified by the user on the command line.  Note that `Rex::Task` objects now contain `args` and `opts` attributes.\r\n\r\n# Fixes\r\n\r\n  * `Rex::Args` parses @ARGV every time it was used.  Moved code out of `import()`.\r\n  * Users can pass in multiple tasks to rex on the command line.  But `Rex::Args` assumes all options are for the first task.  Argument parsing is now fixed in `Rex::RunList->parse_opts()`.  Example:\r\n```\r\nrex lib:task1 --option1=value1 lib:task2 --option1=value2\r\n```\r\n  * Even if Rex::Args parses the arguments correctly, rex can't run a task more than once with different options using only the `Rex::TaskList` concept because it contains a hash of all the tasks (and hashes don't allow duplicate keys).  Fixed this by adding the `Rex::RunList` concept which is based around an arrayref instead of a hashref.  Example:\r\n```\r\nrex lib:task1 --option=value1 lib:task2 --option=value2\r\n```\r\n  * Tasks can now accept arguments as well as options. Example:\r\n```\r\nrex lib:task1 <arg> --option=value\r\n```\r\n\r\n# Note\r\n\r\nI structured my commits neatly (I hope).  It may help to review them one at a time to understand this pr."},"comment":{"url":"https://api.github.com/repos/RexOps/Rex/issues/comments/152441139","html_url":"https://github.com/RexOps/Rex/pull/779#issuecomment-152441139","issue_url":"https://api.github.com/repos/RexOps/Rex/issues/779","id":152441139,"user":{"login":"ferki","id":3117609,"avatar_url":"https://avatars.githubusercontent.com/u/3117609?v=3","gravatar_id":"","url":"https://api.github.com/users/ferki","html_url":"https://github.com/ferki","followers_url":"https://api.github.com/users/ferki/followers","following_url":"https://api.github.com/users/ferki/following{/other_user}","gists_url":"https://api.github.com/users/ferki/gists{/gist_id}","starred_url":"https://api.github.com/users/ferki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferki/subscriptions","organizations_url":"https://api.github.com/users/ferki/orgs","repos_url":"https://api.github.com/users/ferki/repos","events_url":"https://api.github.com/users/ferki/events{/privacy}","received_events_url":"https://api.github.com/users/ferki/received_events","type":"User","site_admin":false},"created_at":"2015-10-30T06:20:27Z","updated_at":"2015-10-30T06:20:27Z","body":"I'm sorry for being a bit late to the party, and just seemingly ranting around randomly, but I find the way how it was merged very confusing (i.e. everything squashed into a single big commit, or how depreacation is handled in th end). Since it's in master, it's too late to cleanup/change, so I think I'll just refactor some of the stuff included here."}}