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
|
# File 'lib/drakkon/lib/images/flip_flop.rb', line 5
def self.run!(args = [])
horizontal = if args.empty?
prompt.yes?('Flip Horizontally?')
else
v = args.shift.downcase
%w[yes y].include?(v)
end
vertical = if args.empty?
prompt.yes?('Flip Vertically?')
else
v = args.shift.downcase
%w[yes y].include?(v)
end
puts <<~HELP
Usage [horizontal] [vertical]
- Run in the directory you wish to modify the images
- Flip/Flop the images via MiniMagick
- y / yes / Y / Yes for affirmative args
Horizontal: #{horizontal}
Vertical: #{vertical}
Current Directory;
#{Dir.pwd.pastel(:yellow)}
Images:
HELP
images.sort.each do |img|
img_s = img.gsub("#{Dir.pwd}/", '').pastel(:yellow)
puts " - #{img_s}"
end
puts
exit unless prompt.yes? "#{'Are you sure?'.pastel(:bright_yellow)} Flip/Flop!? #{'(Destructive)'.pastel(:red)}"
start(horizontal, vertical)
end
|