-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.rb
More file actions
32 lines (29 loc) · 703 Bytes
/
cli.rb
File metadata and controls
32 lines (29 loc) · 703 Bytes
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
require 'rubygems'
require_relative 'lib/data_generator'
dg = DataGenerator.new
def paste_command
if RUBY_PLATFORM =~ /mswin/
'clip'
else
'pbcopy'
end
end
if ARGV[0] != nil
case ARGV[0]
when "email"
output = dg.random_email(ARGV[1])
when "words"
output = dg.random_words(ARGV[1])
when "special_chars"
output = dg.special_characters
else
#TODO: Make this a better error message
output = "Invalid parameters."
end
#TODO: fix so the "Invalid parameters" message doesn't get copied to clipboard.
`echo #{output} | #{paste_command}`
puts output
else
#TODO: Make this a better error message
puts "Please specify a function."
end