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
|
# File 'lib/bepasty-client/cli.rb', line 11
def run
parse
load_config
if @server.nil?
warn 'Specify server URL using option --server or via config file'
exit(false)
end
client = Client.new(@server, password: @password, verbose: @verbose)
client.setup
if @files.empty?
puts client.upload_io(STDIN, **@upload_opts)
else
@files.each do |path|
file_loc = File.open(path, 'r') do |f|
client.upload_io(f, **@upload_opts)
end
if @files.length > 1
puts "#{path}: #{file_loc}"
else
puts file_loc
end
end
end
rescue Error => e
warn "Error occurred: #{e.message}"
exit(false)
end
|