{"action":"created","comment":{"url":"https://api.github.com/repos/titon/framework/pulls/comments/26171275","id":26171275,"diff_hunk":"@@ -0,0 +1,344 @@\n+<?hh // strict\n+/**\n+ * @copyright   2010-2015, The Titon Project\n+ * @license     http://opensource.org/licenses/bsd-license.php\n+ * @link        http://titon.io\n+ */\n+\n+namespace Titon\\Console\\Command;\n+\n+use Titon\\Console\\InputBag;\n+use Titon\\Console\\Command;\n+use Titon\\Console\\Input;\n+use Titon\\Console\\Output;\n+use Titon\\Console\\InputDefinition\\Argument;\n+use Titon\\Console\\InputDefinition\\Flag;\n+use Titon\\Console\\InputDefinition\\Option;\n+use Titon\\Console\\UserInput\\Menu;\n+use Titon\\Console\\UserInput\\Prompt;\n+\n+/**\n+ * A `Command` is a class that configures necessary command line inputs from the\n+ * user and executes its `run` method when called.\n+ *\n+ * @package Titon\\Console\\Command\n+ */\n+abstract class AbstractCommand implements Command {\n+\n+    /**\n+     * Bag container holding all registered `Argument` objects\n+     *\n+     * @var \\Titon\\Console\\InputBag<Argument>\n+     */\n+    protected InputBag<Argument> $arguments;\n+\n+    /**\n+     * The description of the command used when rendering its help screen.\n+     *\n+     * @var string\n+     */\n+    protected string $description = '';\n+\n+    /**\n+     * Bag container holding all registered `Flag` objects\n+     *\n+     * @var \\Titon\\Console\\InputBag<Flag>\n+     */\n+    protected InputBag<Flag> $flags;\n+\n+    /**\n+     * The `Input` object containing all registered and parsed command line\n+     * parameters.\n+     *\n+     * @var \\Titon\\Console\\Input\n+     */\n+    protected Input $input;\n+\n+    /**\n+     * The name of the command passed into the command line.\n+     *\n+     * @var string\n+     */\n+    protected string $name = '';\n+\n+    /**\n+     * Bag container holding all registered `Option` objects\n+     *\n+     * @var \\Titon\\Console\\InputBag<Option>\n+     */\n+    protected InputBag<Option> $options;\n+\n+    /**\n+     * The `Output` object to handle output to the user.\n+     *\n+     * @var \\Titon\\Console\\Output\n+     */\n+    protected Output $output;\n+\n+    /**\n+     * Construct a new instance of a command.\n+     */\n+    public function __construct(Input $input, Output $output) {\n+        $this->input = $input;\n+        $this->output = $output;\n+        $this->arguments = new InputBag();\n+        $this->flags = new InputBag();\n+        $this->options = new InputBag();\n+    }\n+\n+    /**\n+     * Add a new `Argument` to be registered and parsed with the `Input`.\n+     *\n+     * @param \\Titon\\Console\\InputDefinition\\Argument $argument\n+     *\n+     * @return $this\n+     */\n+    public function addArgument(Argument $argument): this {\n+        $this->arguments->set($argument->getName(), $argument);\n+\n+        return $this;\n+    }\n+\n+    /**\n+     * Add a new `Flag` to be registered and parsed with the `Input`.\n+     *\n+     * @param \\Titon\\Console\\InputDefinition\\Flag $flag\n+     *\n+     * @return $this\n+     */\n+    public function addFlag(Flag $flag): this {\n+        $this->flags->set($flag->getName(), $flag);\n+\n+        return $this;\n+    }\n+\n+    /**\n+     * Add a new `Option` to be registered and parsed with the `Input`.\n+     *\n+     * @param \\Titon\\Console\\InputDefinition\\Option $option\n+     *\n+     * @return $this\n+     */\n+    public function addOption(Option $option): this {\n+        $this->options->set($option->getName(), $option);\n+\n+        return $this;\n+    }\n+\n+    /**\n+     * Construct and return a new `Menu` object given the choices and display\n+     * message.\n+     *\n+     * @param Map<mixed, mixed> $choices    Accepted values\n+     * @param string $message               The message to display before the choices\n+     *\n+     * @return \\Titon\\Console\\UserInput\\Menu\n+     */\n+    protected function confirm(Map<mixed, mixed> $choices, string $message = ''): Menu {\n+        $menu = new Menu($this->input, $this->output);\n+        $menu->setAcceptedValues($choices)->setMessage($message);\n+\n+        return $menu;\n+    }\n+\n+    /**\n+     * Alias method for sending output through STDERROR.\n+     *\n+     * @param string $output    The message to send\n+     */\n+    protected function error(string $output): void {\n+        $this->output->error($output);\n+    }\n+\n+    /**\n+     * Retrieve an `Argument` value by key.\n+     *\n+     * @param string $key\n+     *\n+     * @return mixed\n+     */\n+    protected function getArgument(string $key): ?string {","path":"src/Titon/Console/Command/AbstractCommand.hh","position":160,"original_position":160,"commit_id":"6647dc080645b62092ee9cda990cf1381b8b5dae","original_commit_id":"6647dc080645b62092ee9cda990cf1381b8b5dae","user":{"login":"exonintrendo","id":3135216,"avatar_url":"https://avatars.githubusercontent.com/u/3135216?v=3","gravatar_id":"","url":"https://api.github.com/users/exonintrendo","html_url":"https://github.com/exonintrendo","followers_url":"https://api.github.com/users/exonintrendo/followers","following_url":"https://api.github.com/users/exonintrendo/following{/other_user}","gists_url":"https://api.github.com/users/exonintrendo/gists{/gist_id}","starred_url":"https://api.github.com/users/exonintrendo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exonintrendo/subscriptions","organizations_url":"https://api.github.com/users/exonintrendo/orgs","repos_url":"https://api.github.com/users/exonintrendo/repos","events_url":"https://api.github.com/users/exonintrendo/events{/privacy}","received_events_url":"https://api.github.com/users/exonintrendo/received_events","type":"User","site_admin":false},"body":"These are easy aliases to the Input value getter of the definitions. I'm pushing up a commit that allows a default value to be  passed in, so null could be valid here.","created_at":"2015-03-10T22:05:41Z","updated_at":"2015-03-10T22:05:41Z","html_url":"https://github.com/titon/framework/pull/76#discussion_r26171275","pull_request_url":"https://api.github.com/repos/titon/framework/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/titon/framework/pulls/comments/26171275"},"html":{"href":"https://github.com/titon/framework/pull/76#discussion_r26171275"},"pull_request":{"href":"https://api.github.com/repos/titon/framework/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/titon/framework/pulls/76","id":30804695,"html_url":"https://github.com/titon/framework/pull/76","diff_url":"https://github.com/titon/framework/pull/76.diff","patch_url":"https://github.com/titon/framework/pull/76.patch","issue_url":"https://api.github.com/repos/titon/framework/issues/76","number":76,"state":"open","locked":false,"title":"Console package","user":{"login":"exonintrendo","id":3135216,"avatar_url":"https://avatars.githubusercontent.com/u/3135216?v=3","gravatar_id":"","url":"https://api.github.com/users/exonintrendo","html_url":"https://github.com/exonintrendo","followers_url":"https://api.github.com/users/exonintrendo/followers","following_url":"https://api.github.com/users/exonintrendo/following{/other_user}","gists_url":"https://api.github.com/users/exonintrendo/gists{/gist_id}","starred_url":"https://api.github.com/users/exonintrendo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exonintrendo/subscriptions","organizations_url":"https://api.github.com/users/exonintrendo/orgs","repos_url":"https://api.github.com/users/exonintrendo/repos","events_url":"https://api.github.com/users/exonintrendo/events{/privacy}","received_events_url":"https://api.github.com/users/exonintrendo/received_events","type":"User","site_admin":false},"body":"Console package for building command line applications.","created_at":"2015-03-09T22:03:59Z","updated_at":"2015-03-10T22:05:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fbcc1cc79a92a17872aecdadb7a4396754a1f4a1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/titon/framework/pulls/76/commits","review_comments_url":"https://api.github.com/repos/titon/framework/pulls/76/comments","review_comment_url":"https://api.github.com/repos/titon/framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/titon/framework/issues/76/comments","statuses_url":"https://api.github.com/repos/titon/framework/statuses/6647dc080645b62092ee9cda990cf1381b8b5dae","head":{"label":"titon:console-package","ref":"console-package","sha":"6647dc080645b62092ee9cda990cf1381b8b5dae","user":{"login":"titon","id":224313,"avatar_url":"https://avatars.githubusercontent.com/u/224313?v=3","gravatar_id":"","url":"https://api.github.com/users/titon","html_url":"https://github.com/titon","followers_url":"https://api.github.com/users/titon/followers","following_url":"https://api.github.com/users/titon/following{/other_user}","gists_url":"https://api.github.com/users/titon/gists{/gist_id}","starred_url":"https://api.github.com/users/titon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/titon/subscriptions","organizations_url":"https://api.github.com/users/titon/orgs","repos_url":"https://api.github.com/users/titon/repos","events_url":"https://api.github.com/users/titon/events{/privacy}","received_events_url":"https://api.github.com/users/titon/received_events","type":"Organization","site_admin":false},"repo":{"id":20363624,"name":"framework","full_name":"titon/framework","owner":{"login":"titon","id":224313,"avatar_url":"https://avatars.githubusercontent.com/u/224313?v=3","gravatar_id":"","url":"https://api.github.com/users/titon","html_url":"https://github.com/titon","followers_url":"https://api.github.com/users/titon/followers","following_url":"https://api.github.com/users/titon/following{/other_user}","gists_url":"https://api.github.com/users/titon/gists{/gist_id}","starred_url":"https://api.github.com/users/titon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/titon/subscriptions","organizations_url":"https://api.github.com/users/titon/orgs","repos_url":"https://api.github.com/users/titon/repos","events_url":"https://api.github.com/users/titon/events{/privacy}","received_events_url":"https://api.github.com/users/titon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/titon/framework","description":"A modular Hack framework that runs on HHVM.","fork":false,"url":"https://api.github.com/repos/titon/framework","forks_url":"https://api.github.com/repos/titon/framework/forks","keys_url":"https://api.github.com/repos/titon/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/titon/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/titon/framework/teams","hooks_url":"https://api.github.com/repos/titon/framework/hooks","issue_events_url":"https://api.github.com/repos/titon/framework/issues/events{/number}","events_url":"https://api.github.com/repos/titon/framework/events","assignees_url":"https://api.github.com/repos/titon/framework/assignees{/user}","branches_url":"https://api.github.com/repos/titon/framework/branches{/branch}","tags_url":"https://api.github.com/repos/titon/framework/tags","blobs_url":"https://api.github.com/repos/titon/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/titon/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/titon/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/titon/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/titon/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/titon/framework/languages","stargazers_url":"https://api.github.com/repos/titon/framework/stargazers","contributors_url":"https://api.github.com/repos/titon/framework/contributors","subscribers_url":"https://api.github.com/repos/titon/framework/subscribers","subscription_url":"https://api.github.com/repos/titon/framework/subscription","commits_url":"https://api.github.com/repos/titon/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/titon/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/titon/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/titon/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/titon/framework/contents/{+path}","compare_url":"https://api.github.com/repos/titon/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/titon/framework/merges","archive_url":"https://api.github.com/repos/titon/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/titon/framework/downloads","issues_url":"https://api.github.com/repos/titon/framework/issues{/number}","pulls_url":"https://api.github.com/repos/titon/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/titon/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/titon/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/titon/framework/labels{/name}","releases_url":"https://api.github.com/repos/titon/framework/releases{/id}","created_at":"2014-05-31T19:37:47Z","updated_at":"2015-03-08T19:28:28Z","pushed_at":"2015-03-10T16:34:37Z","git_url":"git://github.com/titon/framework.git","ssh_url":"git@github.com:titon/framework.git","clone_url":"https://github.com/titon/framework.git","svn_url":"https://github.com/titon/framework","homepage":"http://titon.io","size":3341,"stargazers_count":114,"watchers_count":114,"language":"Hack","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":4,"forks":9,"open_issues":4,"watchers":114,"default_branch":"master"}},"base":{"label":"titon:master","ref":"master","sha":"082a3ed7e1f79e2595dff5ad36eab982aea772e3","user":{"login":"titon","id":224313,"avatar_url":"https://avatars.githubusercontent.com/u/224313?v=3","gravatar_id":"","url":"https://api.github.com/users/titon","html_url":"https://github.com/titon","followers_url":"https://api.github.com/users/titon/followers","following_url":"https://api.github.com/users/titon/following{/other_user}","gists_url":"https://api.github.com/users/titon/gists{/gist_id}","starred_url":"https://api.github.com/users/titon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/titon/subscriptions","organizations_url":"https://api.github.com/users/titon/orgs","repos_url":"https://api.github.com/users/titon/repos","events_url":"https://api.github.com/users/titon/events{/privacy}","received_events_url":"https://api.github.com/users/titon/received_events","type":"Organization","site_admin":false},"repo":{"id":20363624,"name":"framework","full_name":"titon/framework","owner":{"login":"titon","id":224313,"avatar_url":"https://avatars.githubusercontent.com/u/224313?v=3","gravatar_id":"","url":"https://api.github.com/users/titon","html_url":"https://github.com/titon","followers_url":"https://api.github.com/users/titon/followers","following_url":"https://api.github.com/users/titon/following{/other_user}","gists_url":"https://api.github.com/users/titon/gists{/gist_id}","starred_url":"https://api.github.com/users/titon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/titon/subscriptions","organizations_url":"https://api.github.com/users/titon/orgs","repos_url":"https://api.github.com/users/titon/repos","events_url":"https://api.github.com/users/titon/events{/privacy}","received_events_url":"https://api.github.com/users/titon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/titon/framework","description":"A modular Hack framework that runs on HHVM.","fork":false,"url":"https://api.github.com/repos/titon/framework","forks_url":"https://api.github.com/repos/titon/framework/forks","keys_url":"https://api.github.com/repos/titon/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/titon/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/titon/framework/teams","hooks_url":"https://api.github.com/repos/titon/framework/hooks","issue_events_url":"https://api.github.com/repos/titon/framework/issues/events{/number}","events_url":"https://api.github.com/repos/titon/framework/events","assignees_url":"https://api.github.com/repos/titon/framework/assignees{/user}","branches_url":"https://api.github.com/repos/titon/framework/branches{/branch}","tags_url":"https://api.github.com/repos/titon/framework/tags","blobs_url":"https://api.github.com/repos/titon/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/titon/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/titon/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/titon/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/titon/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/titon/framework/languages","stargazers_url":"https://api.github.com/repos/titon/framework/stargazers","contributors_url":"https://api.github.com/repos/titon/framework/contributors","subscribers_url":"https://api.github.com/repos/titon/framework/subscribers","subscription_url":"https://api.github.com/repos/titon/framework/subscription","commits_url":"https://api.github.com/repos/titon/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/titon/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/titon/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/titon/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/titon/framework/contents/{+path}","compare_url":"https://api.github.com/repos/titon/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/titon/framework/merges","archive_url":"https://api.github.com/repos/titon/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/titon/framework/downloads","issues_url":"https://api.github.com/repos/titon/framework/issues{/number}","pulls_url":"https://api.github.com/repos/titon/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/titon/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/titon/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/titon/framework/labels{/name}","releases_url":"https://api.github.com/repos/titon/framework/releases{/id}","created_at":"2014-05-31T19:37:47Z","updated_at":"2015-03-08T19:28:28Z","pushed_at":"2015-03-10T16:34:37Z","git_url":"git://github.com/titon/framework.git","ssh_url":"git@github.com:titon/framework.git","clone_url":"https://github.com/titon/framework.git","svn_url":"https://github.com/titon/framework","homepage":"http://titon.io","size":3341,"stargazers_count":114,"watchers_count":114,"language":"Hack","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":4,"forks":9,"open_issues":4,"watchers":114,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/titon/framework/pulls/76"},"html":{"href":"https://github.com/titon/framework/pull/76"},"issue":{"href":"https://api.github.com/repos/titon/framework/issues/76"},"comments":{"href":"https://api.github.com/repos/titon/framework/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/titon/framework/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/titon/framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/titon/framework/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/titon/framework/statuses/6647dc080645b62092ee9cda990cf1381b8b5dae"}}}}