-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslack_emoji.rb
61 lines (50 loc) · 1.28 KB
/
slack_emoji.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require 'fileutils'
require 'optparse'
require_relative './emoji_generator'
def print_help
File.open('./help.txt', 'r') do |f|
f.each { |line| puts line }
end
end
options = {
emoji_size: '60x60',
bg_color: 'transparent',
font: 'ArialUnicode',
font_size: 15,
text_color: 'pink',
output: nil
}
begin
OptionParser.new do |opts|
opts.on('-h', '--help', 'Print help') do |_v|
print_help
exit
end
opts.on('-b', '--background=BACKGROUND', 'Emoji background color') do |v|
options.merge!(bg_color: v.to_s)
end
opts.on('-z', '--font=FONT', 'Emoji text font') do |v|
options.merge!(font: v.to_s)
end
opts.on('-f', '--fontsize=FONTSIZE', 'Emoji font size') do |v|
options.merge!(font_size: v.to_s)
end
opts.on('-o', '--output=OUTPUT', 'Emoji output file') do |v|
options.merge!(output: v.to_s)
end
opts.on('-s', '--esize=ESIZE', 'Emoji size') do |v|
options.merge!(emoji_size: v)
end
opts.on('-t', '--txtcolor=TXTCOLOR', 'Emoji text color') do |v|
options.merge!(text_color: v)
end
end.parse!
rescue StandardError => e
puts e.message
puts e.backtrace[0, 10]
print_help
exit
end
options[:text] = ARGV[0]
generator = EmojiGenerator.new(**options)
generator.generate_emoji