Last active
September 3, 2020 20:07
-
-
Save ryangreenberg/c319610a4abc5c5d0a68e387ace25d6a to your computer and use it in GitHub Desktop.
Slack Launch Topic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# set the channel topic: ▓░░░░░░░░░░░░░░░░░░░ 1% | |
# set the channel topic: ▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░ 50% | |
# set the channel topic: ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100% | |
blocks = 20 | |
percent = ARGV[0] | |
abort "#{$PROGRAM_NAME} <0-100>" unless percent | |
filled = [(percent.to_f / 100.0 * blocks).ceil, blocks].min | |
empty = [blocks - filled, 0].max | |
puts "#{'▓' * filled}#{'░' * empty} *#{percent}%*" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment