{"action":"created","issue":{"url":"https://api.github.com/repos/vivien/i3blocks-contrib/issues/8","labels_url":"https://api.github.com/repos/vivien/i3blocks-contrib/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/vivien/i3blocks-contrib/issues/8/comments","events_url":"https://api.github.com/repos/vivien/i3blocks-contrib/issues/8/events","html_url":"https://github.com/vivien/i3blocks-contrib/pull/8","id":105680121,"number":8,"title":"batterybar:  displays the battery level as a bar","user":{"login":"Keftaa","id":14205498,"avatar_url":"https://avatars.githubusercontent.com/u/14205498?v=3","gravatar_id":"","url":"https://api.github.com/users/Keftaa","html_url":"https://github.com/Keftaa","followers_url":"https://api.github.com/users/Keftaa/followers","following_url":"https://api.github.com/users/Keftaa/following{/other_user}","gists_url":"https://api.github.com/users/Keftaa/gists{/gist_id}","starred_url":"https://api.github.com/users/Keftaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Keftaa/subscriptions","organizations_url":"https://api.github.com/users/Keftaa/orgs","repos_url":"https://api.github.com/users/Keftaa/repos","events_url":"https://api.github.com/users/Keftaa/events{/privacy}","received_events_url":"https://api.github.com/users/Keftaa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-09T20:41:09Z","updated_at":"2015-09-10T22:29:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/vivien/i3blocks-contrib/pulls/8","html_url":"https://github.com/vivien/i3blocks-contrib/pull/8","diff_url":"https://github.com/vivien/i3blocks-contrib/pull/8.diff","patch_url":"https://github.com/vivien/i3blocks-contrib/pull/8.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/vivien/i3blocks-contrib/issues/comments/139400451","html_url":"https://github.com/vivien/i3blocks-contrib/pull/8#issuecomment-139400451","issue_url":"https://api.github.com/repos/vivien/i3blocks-contrib/issues/8","id":139400451,"user":{"login":"kb100","id":1966710,"avatar_url":"https://avatars.githubusercontent.com/u/1966710?v=3","gravatar_id":"","url":"https://api.github.com/users/kb100","html_url":"https://github.com/kb100","followers_url":"https://api.github.com/users/kb100/followers","following_url":"https://api.github.com/users/kb100/following{/other_user}","gists_url":"https://api.github.com/users/kb100/gists{/gist_id}","starred_url":"https://api.github.com/users/kb100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kb100/subscriptions","organizations_url":"https://api.github.com/users/kb100/orgs","repos_url":"https://api.github.com/users/kb100/repos","events_url":"https://api.github.com/users/kb100/events{/privacy}","received_events_url":"https://api.github.com/users/kb100/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T22:29:08Z","updated_at":"2015-09-10T22:29:08Z","body":"I have a few comments about this script before I think it would be ready to merge.\r\n\r\nFirstly, the regex does not capture all possible states that acpi reports. In particular, if the script runs right as you plug or unplug your charger, acpi may say unknown. Such an outcome would crash your script. Make sure to check if `$percentage` is not empty first. \r\n\r\nSecondly, the double and triple wildcard matching should really be improved. Why not, e.g. `acpi battery | grep -m1 -o '[0-9]\\{1,3\\}%$'\r\n\r\nNext I suggest that the if blocks and case statements should be styled like the scripts in the main repo. Namely\r\n\r\n    if (( ... )); then\r\n        ...\r\n        #four space indentation\r\n    fi\r\n\r\n    case \"$status\" in\r\n        a) color=red ;;\r\n        ...\r\n    esac\r\n\r\n   #or\r\n    case \"$status\" in\r\n        a) \r\n            color=red \r\n            ;;\r\n        ...\r\n    esac\r\n\r\n    \r\nAlso `if (( $BLOCK_BUTTON == 1))` should be `if [ \"$BLOCK_BUTTON\" -eq 1 ]` as the former will crash when the block button is not defined."}}