bin/rmega-up in rmega-0.2.5 vs bin/rmega-up in rmega-0.2.6
- old
+ new
@@ -20,10 +20,14 @@
opts.on("-r PATH", "--remote-path", "Remote path") { |path|
cli_options[:remote_path] = path
}
+ opts.on("-l", "--get-link", "Generate and print the sharable link (witk key)") {
+ cli_options[:get_link] = true
+ }
+
apply_opt_parser_options(opts)
end.parse!
cli_rescue do
raise("File not found - #{cli_options[:path]}") unless File.exists?(cli_options[:path])
@@ -35,7 +39,11 @@
node = traverse_storage(root, cli_options[:remote_path].to_s.dup, :only_folders => true)
raise("Node not found - #{cli_options[:remote_path]}") unless node
raise("Node cannot be a file - #{cli_options[:remote_path]}") if node.type == :file
- node.upload(cli_options[:path])
+ file = node.upload(cli_options[:path])
+
+ if cli_options[:get_link]
+ puts file.public_url
+ end
end