{"action":"created","issue":{"url":"https://api.github.com/repos/hoaproject/Console/issues/51","labels_url":"https://api.github.com/repos/hoaproject/Console/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/hoaproject/Console/issues/51/comments","events_url":"https://api.github.com/repos/hoaproject/Console/issues/51/events","html_url":"https://github.com/hoaproject/Console/pull/51","id":108071547,"number":51,"title":"Introduce the `Input` class","user":{"login":"Hywan","id":946104,"avatar_url":"https://avatars.githubusercontent.com/u/946104?v=3","gravatar_id":"","url":"https://api.github.com/users/Hywan","html_url":"https://github.com/Hywan","followers_url":"https://api.github.com/users/Hywan/followers","following_url":"https://api.github.com/users/Hywan/following{/other_user}","gists_url":"https://api.github.com/users/Hywan/gists{/gist_id}","starred_url":"https://api.github.com/users/Hywan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hywan/subscriptions","organizations_url":"https://api.github.com/users/Hywan/orgs","repos_url":"https://api.github.com/users/Hywan/repos","events_url":"https://api.github.com/users/Hywan/events{/privacy}","received_events_url":"https://api.github.com/users/Hywan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hoaproject/Console/labels/difficulty:%20medium","name":"difficulty: medium","color":"F0788C"},{"url":"https://api.github.com/repos/hoaproject/Console/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/hoaproject/Console/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"jubianchi","id":327237,"avatar_url":"https://avatars.githubusercontent.com/u/327237?v=3","gravatar_id":"","url":"https://api.github.com/users/jubianchi","html_url":"https://github.com/jubianchi","followers_url":"https://api.github.com/users/jubianchi/followers","following_url":"https://api.github.com/users/jubianchi/following{/other_user}","gists_url":"https://api.github.com/users/jubianchi/gists{/gist_id}","starred_url":"https://api.github.com/users/jubianchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jubianchi/subscriptions","organizations_url":"https://api.github.com/users/jubianchi/orgs","repos_url":"https://api.github.com/users/jubianchi/repos","events_url":"https://api.github.com/users/jubianchi/events{/privacy}","received_events_url":"https://api.github.com/users/jubianchi/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-09-24T07:01:00Z","updated_at":"2015-10-26T07:38:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hoaproject/Console/pulls/51","html_url":"https://github.com/hoaproject/Console/pull/51","diff_url":"https://github.com/hoaproject/Console/pull/51.diff","patch_url":"https://github.com/hoaproject/Console/pull/51.patch"},"body":"## Old title\r\n\r\nImagine this case:\r\n```sh\r\n$ php foo.php\r\n```\r\nwhere `foo.php` is a program that reads from `STDIN`. It works perfectly with `Hoa\\Console`.\r\n\r\nNow, imagine this other case:\r\n```sh\r\n$ echo \"foo\\nbar\" | php foo.php\r\n```\r\n`STDIN` will contain `foo` and `bar` but the `Hoa\\Console\\Cursor` —for instance— will no longer work since it reads from `STDIN` too.\r\n\r\nThe idea is then to close `STDIN` (aka `php://input`) and open `/dev/tty`, which is the real standard input in this case.\r\n\r\nSo, to address these needs, we introduce the `Hoa\\Console::getStdin` method that is a helper to choose the appopriate standard input. We also change the `Hoa\\Console::advancedInteraction` behavior: 👷 `stty` uses the `-f` option to specify `/dev/tty` instead of the default standard input. However, on Linux, this is `-F`. I don't know how to address this right now (I mean: Making something cross-platform).\r\n\r\nFinally, all `Hoa\\Console`'s classes that were using `STDIN` directly are now using `Hoa\\Console::getStdin`.\r\n\r\n## New title\r\n\r\nActually, since #55, this PR has taken a new path. We also introduced an `Input` class. And it considers whether to use `Hoa\\File\\Read('php://stdin')` as the default input, or `Hoa\\File\\Read('/dev/tty')` in case the former has been closed. This is a basic wrapper."},"comment":{"url":"https://api.github.com/repos/hoaproject/Console/issues/comments/151050258","html_url":"https://github.com/hoaproject/Console/pull/51#issuecomment-151050258","issue_url":"https://api.github.com/repos/hoaproject/Console/issues/51","id":151050258,"user":{"login":"Hywan","id":946104,"avatar_url":"https://avatars.githubusercontent.com/u/946104?v=3","gravatar_id":"","url":"https://api.github.com/users/Hywan","html_url":"https://github.com/Hywan","followers_url":"https://api.github.com/users/Hywan/followers","following_url":"https://api.github.com/users/Hywan/following{/other_user}","gists_url":"https://api.github.com/users/Hywan/gists{/gist_id}","starred_url":"https://api.github.com/users/Hywan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hywan/subscriptions","organizations_url":"https://api.github.com/users/Hywan/orgs","repos_url":"https://api.github.com/users/Hywan/repos","events_url":"https://api.github.com/users/Hywan/events{/privacy}","received_events_url":"https://api.github.com/users/Hywan/received_events","type":"User","site_admin":false},"created_at":"2015-10-26T07:38:48Z","updated_at":"2015-10-26T07:38:48Z","body":"I guess we can merge this patch before, though? This is safe enough for now."}}