{"action":"created","issue":{"url":"https://api.github.com/repos/Homebrew/homebrew/issues/42281","labels_url":"https://api.github.com/repos/Homebrew/homebrew/issues/42281/labels{/name}","comments_url":"https://api.github.com/repos/Homebrew/homebrew/issues/42281/comments","events_url":"https://api.github.com/repos/Homebrew/homebrew/issues/42281/events","html_url":"https://github.com/Homebrew/homebrew/pull/42281","id":98294899,"number":42281,"title":"Implement `brew desc`, with a cache","user":{"login":"hivehand","id":1063575,"avatar_url":"https://avatars.githubusercontent.com/u/1063575?v=3","gravatar_id":"","url":"https://api.github.com/users/hivehand","html_url":"https://github.com/hivehand","followers_url":"https://api.github.com/users/hivehand/followers","following_url":"https://api.github.com/users/hivehand/following{/other_user}","gists_url":"https://api.github.com/users/hivehand/gists{/gist_id}","starred_url":"https://api.github.com/users/hivehand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hivehand/subscriptions","organizations_url":"https://api.github.com/users/hivehand/orgs","repos_url":"https://api.github.com/users/hivehand/repos","events_url":"https://api.github.com/users/hivehand/events{/privacy}","received_events_url":"https://api.github.com/users/hivehand/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Homebrew/homebrew/labels/features","name":"features","color":"DDDDDD"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":33,"created_at":"2015-07-31T00:58:28Z","updated_at":"2015-09-06T11:45:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Homebrew/homebrew/pulls/42281","html_url":"https://github.com/Homebrew/homebrew/pull/42281","diff_url":"https://github.com/Homebrew/homebrew/pull/42281.diff","patch_url":"https://github.com/Homebrew/homebrew/pull/42281.patch"},"body":"This is an attempt to recreate @telemachus’s `brew desc` tool, using the `desc` component now built into formulae. Like the original `brew desc`, it lets you look up formulae either by their exact names, or by searching through some combination of name and description.\r\n\r\n**Notes:**\r\n\r\n- It follows the [suggestion] made by @mistydemeo, in the discussion over the pull request that added `desc` to formulae, and uses a cache for performance.\r\n- Said cache tries to be “pay-as-you-go”: the cache isn't created, or updated, until you either explicitly do so with `brew desc --cache`, or perform a search. This allows people who don’t expect to use `brew desc` to avoid paying ~5 extra seconds with every `brew update`.\r\n- A slight performance tweak to `utils.rb`’s maximum-length-determination logic, with input from @bfontaine, came along for the ride.\r\n\r\n[suggestion]: https://github.com/Homebrew/homebrew/pull/39911#issuecomment-103697853\r\n\r\n**Caveats:**\r\n\r\n- I have almost no personal experience with Kegs or Casks, and so can’t guarantee that `desc` and the cache work properly with them.\r\n- I’m not well-versed with brew’s model for handling `ARGV`, so it’s possible that I’m making a lot of unnecessary noise in the `desc.rb` command handling.\r\n\r\n**Open Questions:**\r\n\r\n- `brew search --desc` is exactly equivalent to `brew desc -d`. I’m not sure it makes sense to preserve both, particularly since the former was never documented, but for the time being I’ve rewritten it to take advantage of the cache.\r\n- The cache-generation code is completely silent. I don’t know if we want to notify the user to the effect that “It’s OK! Something’s actually happening!” when the first attempt to run `brew desc` takes several seconds.\r\n\r\nFeedback is more than welcome.\r\n"},"comment":{"url":"https://api.github.com/repos/Homebrew/homebrew/issues/comments/138075461","html_url":"https://github.com/Homebrew/homebrew/pull/42281#issuecomment-138075461","issue_url":"https://api.github.com/repos/Homebrew/homebrew/issues/42281","id":138075461,"user":{"login":"mikemcquaid","id":125011,"avatar_url":"https://avatars.githubusercontent.com/u/125011?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemcquaid","html_url":"https://github.com/mikemcquaid","followers_url":"https://api.github.com/users/mikemcquaid/followers","following_url":"https://api.github.com/users/mikemcquaid/following{/other_user}","gists_url":"https://api.github.com/users/mikemcquaid/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemcquaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemcquaid/subscriptions","organizations_url":"https://api.github.com/users/mikemcquaid/orgs","repos_url":"https://api.github.com/users/mikemcquaid/repos","events_url":"https://api.github.com/users/mikemcquaid/events{/privacy}","received_events_url":"https://api.github.com/users/mikemcquaid/received_events","type":"User","site_admin":true},"created_at":"2015-09-06T11:45:40Z","updated_at":"2015-09-06T11:45:40Z","body":"The diff looks good to me. If @xu-cheng is happy with it as-is then I'll do some more local testing and merge."}}