{"action":"opened","issue":{"url":"https://api.github.com/repos/soumya92/barista/issues/28","repository_url":"https://api.github.com/repos/soumya92/barista","labels_url":"https://api.github.com/repos/soumya92/barista/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/soumya92/barista/issues/28/comments","events_url":"https://api.github.com/repos/soumya92/barista/issues/28/events","html_url":"https://github.com/soumya92/barista/issues/28","id":321838048,"number":28,"title":"Simplify group","user":{"login":"soumya92","id":507289,"avatar_url":"https://avatars3.githubusercontent.com/u/507289?v=4","gravatar_id":"","url":"https://api.github.com/users/soumya92","html_url":"https://github.com/soumya92","followers_url":"https://api.github.com/users/soumya92/followers","following_url":"https://api.github.com/users/soumya92/following{/other_user}","gists_url":"https://api.github.com/users/soumya92/gists{/gist_id}","starred_url":"https://api.github.com/users/soumya92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soumya92/subscriptions","organizations_url":"https://api.github.com/users/soumya92/orgs","repos_url":"https://api.github.com/users/soumya92/repos","events_url":"https://api.github.com/users/soumya92/events{/privacy}","received_events_url":"https://api.github.com/users/soumya92/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-10T07:33:12Z","updated_at":"2018-05-10T07:33:12Z","closed_at":null,"author_association":"OWNER","body":"group.Add returning a wrapped module is weird. It allows modules in different locations to (dis)appear based on the group's state, which is unexpected, and it makes the API confusing too.\r\n\r\nIdeally, group would work like this:\r\n```go\r\ng := group.Collapsing(module1, module2, module3)\r\ng.ButtonFormat(func(collapsed bool) bar.Output {\r\n  if collapsed {\r\n    return outputs.Text(\"+\");\r\n  }\r\n  return outputs.Text(\"-\");\r\n})\r\nbarista.Add(g)\r\n```\r\nand\r\n```go\r\ng := group.Cycling(module1, module2, module3)\r\ng.ButtonFormat(func(current, max int) bar.Output {\r\n  return outputs.Textf(\"%d/%d\", current, max);\r\n})\r\nbarista.Add(g)\r\n```\r\n\r\nNote that the current behaviour can still be simulated using multiple groups, setting the ButtonFormat to outputs.Empty(), and using a funcs.OnClick to control all the groups simultaneously. It's unlikely to be a common scenario, though, so it makes sense to design the API for the more common case of group and button being together, and all grouped modules being together as well."}}
{"actor":{"display_login":"soumya92"}}